diff --git a/Pattern/Abstractions/Injection/ByContract.cs b/Pattern/Abstractions/Injection/ByContract.cs index ea5c530..a4ba477 100644 --- a/Pattern/Abstractions/Injection/ByContract.cs +++ b/Pattern/Abstractions/Injection/ByContract.cs @@ -37,7 +37,7 @@ namespace Injection => Assert_Injection( BaselineTestNamed.MakeGenericType(type), InjectionMember_Default(), - @default, named); + @default, registered); [DynamicData(nameof(Test_Type_Data), typeof(PatternBase))] [PatternTestMethod("Inject {1} dependency by {2} and {3}"), TestCategory(CATEGORY_INJECT)] diff --git a/Pattern/Abstractions/Parameters/GenericParameter.cs b/Pattern/Abstractions/Parameters/GenericParameter.cs index ee62854..52989f6 100644 --- a/Pattern/Abstractions/Parameters/GenericParameter.cs +++ b/Pattern/Abstractions/Parameters/GenericParameter.cs @@ -28,13 +28,9 @@ namespace Parameters public void GenericParameter(Type type, Type definition, string member, string import, Func func, object registered, object named, object injected, object @default, bool isNamed) -#if BEHAVIOR_V4 || BEHAVIOR_V5 => Assert_Generic_Injected(definition, type, func(new GenericParameter(TDependency)), import, isNamed, registered, registered); -#else - => Assert_Generic_Injected(definition, type, - func(new GenericParameter(TDependency)), import, isNamed, registered, named); -#endif + [PatternTestMethod("GenericParameter(T, null) forces contract: T, null")] [DynamicData(nameof(Parameters_Test_Data)), TestProperty(PARAMETER, nameof(GenericParameter))] @@ -182,7 +178,7 @@ namespace Parameters // Validate Assert.IsNotNull(instance); - Assert.AreEqual(expected, instance.Value); + Assert.AreEqual(registered, instance.Value); } #endregion diff --git a/Pattern/Abstractions/Parameters/OptionalGenericParameter.cs b/Pattern/Abstractions/Parameters/OptionalGenericParameter.cs index 90edd11..3d6608e 100644 --- a/Pattern/Abstractions/Parameters/OptionalGenericParameter.cs +++ b/Pattern/Abstractions/Parameters/OptionalGenericParameter.cs @@ -21,13 +21,8 @@ namespace Parameters public void OptionalGenericParameter(Type type, Type definition, string member, string import, Func func, object registered, object named, object injected, object @default, bool isNamed) -#if BEHAVIOR_V4 || BEHAVIOR_V5 => Assert_Optional_Injected(definition, type, func(new OptionalGenericParameter(TDependency)), @default, import, isNamed, registered, registered); -#else - => Assert_Optional_Injected(definition, type, - func(new OptionalGenericParameter(TDependency)), @default, import, isNamed, registered, named); -#endif [PatternTestMethod("OptionalGenericParameter(T, null) forces contract: T, null")] diff --git a/Pattern/Abstractions/Parameters/OptionalParameter.cs b/Pattern/Abstractions/Parameters/OptionalParameter.cs index 5a0e03b..6d00714 100644 --- a/Pattern/Abstractions/Parameters/OptionalParameter.cs +++ b/Pattern/Abstractions/Parameters/OptionalParameter.cs @@ -16,16 +16,13 @@ namespace Parameters #region Success #if !UNITY_V4 -#if BEHAVIOR_V5 - [Ignore("Contract is ignored")] -#endif [PatternTestMethod("OptionalParameter() preserves annotated contract")] [DynamicData(nameof(Parameters_Test_Data)), TestProperty(PARAMETER, nameof(OptionalParameter))] public void OptionalParameter(Type type, Type definition, string member, string import, Func func, object registered, object named, object injected, object @default, bool isNamed) => Assert_Optionally_Injected(definition.MakeGenericType(type), - func(new OptionalParameter()), @default, import, isNamed, registered, named); + func(new OptionalParameter()), @default, import, isNamed, registered, registered); [PatternTestMethod("OptionalParameter(null) forces contract: AnnotatedType, null")] [DynamicData(nameof(Parameters_Test_Data)), TestProperty(PARAMETER, nameof(OptionalParameter))] diff --git a/Pattern/Abstractions/Parameters/ResolvedParameter.cs b/Pattern/Abstractions/Parameters/ResolvedParameter.cs index 2df262f..715f533 100644 --- a/Pattern/Abstractions/Parameters/ResolvedParameter.cs +++ b/Pattern/Abstractions/Parameters/ResolvedParameter.cs @@ -16,16 +16,13 @@ namespace Parameters #region Success #if !UNITY_V4 -#if BEHAVIOR_V5 - [Ignore("Name is ignored")] -#endif [PatternTestMethod("ResolvedParameter() preserves annotated contract"), TestProperty(PARAMETER, nameof(ResolvedParameter))] [DynamicData(nameof(Parameters_Test_Data))] public void ResolvedParameter(Type type, Type definition, string member, string import, Func func, object registered, object named, object injected, object @default, bool isNamed) => Assert_Parameter_Injected(definition.MakeGenericType(type), - func(new ResolvedParameter()), import, isNamed, registered, named); + func(new ResolvedParameter()), import, isNamed, registered, registered); [PatternTestMethod("ResolvedParameter(null) forces contract: AnnotatedType, null")] diff --git a/Pattern/Implementation/Injection/Methods/Required.cs b/Pattern/Implementation/Injection/Methods/Required.cs index 0251659..30893d2 100644 --- a/Pattern/Implementation/Injection/Methods/Required.cs +++ b/Pattern/Implementation/Injection/Methods/Required.cs @@ -1,4 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; +using Regression; using System; namespace Methods @@ -32,6 +33,12 @@ namespace Methods public override void Member_Injected_ByValue(string test, Type type, object defaultValue, object defaultAttr, object registered, object named, object injected, object overridden, object @default) { } #endif + [DynamicData(nameof(Test_Type_Data), typeof(PatternBase))] + [PatternTestMethod("Inject Named dependency by XxxMember()"), TestCategory(CATEGORY_INJECT)] + public override void Inject_Named_Default(string test, Type type, object defaultValue, object defaultAttr, object registered, object named, object injected, object overridden, object @default) + => Assert_Injection(BaselineTestNamed.MakeGenericType(type), + InjectionMember_Default(), @default, named); + #endregion } }