This commit is contained in:
ENikS 2023-03-11 14:58:03 -08:00
Родитель b23097ade8
Коммит 021c8c9c03
2 изменённых файлов: 2 добавлений и 26 удалений

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

@ -27,28 +27,5 @@ namespace Injection.Optional
Assert.IsNotNull(instance); Assert.IsNotNull(instance);
Assert.AreEqual(expected, instance.Value); Assert.AreEqual(expected, instance.Value);
} }
protected override void Assert_ThrowsWhenNotRegistered(Type type, InjectionMember member, object @default, object expected)
{
// Inject
Container.RegisterType(null, type, null, null, member);
// Act
var instance = Container.Resolve(type, null) as PatternBaseType;
// Validate
Assert.IsNotNull(instance);
Assert.AreEqual(@default, instance.Value);
// Register missing types
RegisterTypes();
// Act
instance = Container.Resolve(type, null) as PatternBaseType;
// Validate
Assert.IsNotNull(instance);
Assert.AreEqual(expected, instance.Value);
}
} }
} }

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

@ -42,9 +42,8 @@ namespace Injection
public virtual void Inject_WithType(string test, Type type, object defaultValue, object defaultAttr, public virtual void Inject_WithType(string test, Type type, object defaultValue, object defaultAttr,
object registered, object named, object injected, object overridden, object registered, object named, object injected, object overridden,
object @default) object @default)
=> Assert_ThrowsWhenNotRegistered( => Assert_Injection(BaselineTestType.MakeGenericType(type),
BaselineTestType.MakeGenericType(type), InjectionMember_Value(type), @default, registered);
InjectionMember_Value(type), @default, registered);
#if BEHAVIOR_V4 || BEHAVIOR_V5 #if BEHAVIOR_V4 || BEHAVIOR_V5
[Ignore("https://github.com/unitycontainer/container/issues/235")] [Ignore("https://github.com/unitycontainer/container/issues/235")]