public void Activator_ResolvesType_WithDependency() { var micro = new MicroConfiguration("Test", null); micro.Register(typeof(ITest), () => new Test(), true); var instance = (IDependency)micro.Activate(typeof(TestDependencyParameter), new KeyValuePair <string, object>[] { }); Assert.NotNull(instance); Assert.NotNull(instance.TestInstance); }
public void Activator_ResolvesType_WithDependency() { var micro = new MicroConfiguration("Test", null, null); micro.Register(typeof(ITest), () => new Test(), true); var instance = (IDependency)micro.Activate(typeof(TestDependencyParameter), new KeyValuePair<string, object>[] { }); Assert.NotNull(instance); Assert.NotNull(instance.TestInstance); }
public void Activator_ResolvesType_WithDependency_AndParameter() { var micro = new MicroConfiguration("Test", null); micro.Register(typeof(ITest), () => new Test(), true); var instance = (IDependency)micro.Activate(typeof(TestDependencyParameterStatic), new[] { new KeyValuePair <string, object>("value", "hello") }); Assert.NotNull(instance); Assert.Equal("hello", ((TestDependencyParameterStatic)instance).Value); }
public void Activator_ResolvesType_WithDependency_AndParameter() { var micro = new MicroConfiguration("Test", null, null); micro.Register(typeof(ITest), () => new Test(), true); var instance = (IDependency)micro.Activate(typeof(TestDependencyParameterStatic), new[] { new KeyValuePair<string, object>("value", "hello") }); Assert.NotNull(instance); Assert.Equal("hello", ((TestDependencyParameterStatic)instance).Value); }