diff --git a/Pattern/Injection/Annotation/Optional.cs b/Pattern/Injection/Annotation/Optional.cs index 8646718..52aa8f4 100644 --- a/Pattern/Injection/Annotation/Optional.cs +++ b/Pattern/Injection/Annotation/Optional.cs @@ -27,28 +27,5 @@ namespace Injection.Optional Assert.IsNotNull(instance); 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); - } } } diff --git a/Pattern/Injection/ByValue.cs b/Pattern/Injection/ByValue.cs index dd2a237..1b59bca 100644 --- a/Pattern/Injection/ByValue.cs +++ b/Pattern/Injection/ByValue.cs @@ -42,9 +42,8 @@ namespace Injection public virtual void Inject_WithType(string test, Type type, object defaultValue, object defaultAttr, object registered, object named, object injected, object overridden, object @default) - => Assert_ThrowsWhenNotRegistered( - BaselineTestType.MakeGenericType(type), - InjectionMember_Value(type), @default, registered); + => Assert_Injection(BaselineTestType.MakeGenericType(type), + InjectionMember_Value(type), @default, registered); #if BEHAVIOR_V4 || BEHAVIOR_V5 [Ignore("https://github.com/unitycontainer/container/issues/235")]