This commit is contained in:
ENikS 2023-03-16 17:32:32 -07:00
Родитель 529dc79ae1
Коммит f503f9fa41
6 изменённых файлов: 12 добавлений и 20 удалений

Просмотреть файл

@ -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)]

Просмотреть файл

@ -28,13 +28,9 @@ namespace Parameters
public void GenericParameter(Type type, Type definition, string member, string import,
Func<object, InjectionMember> 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

Просмотреть файл

@ -21,13 +21,8 @@ namespace Parameters
public void OptionalGenericParameter(Type type, Type definition, string member, string import,
Func<object, InjectionMember> 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")]

Просмотреть файл

@ -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<object, InjectionMember> 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))]

Просмотреть файл

@ -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<object, InjectionMember> 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")]

Просмотреть файл

@ -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
}
}