public void TestConstructWithProperty() { var property = new TestClass1(); SimpleIoc.Default.Reset(); SimpleIoc.Default.Register(() => new TestClass6 { MyProperty = property }); var instance1 = new TestClass6(); Assert.NotNull(instance1); Assert.Null(instance1.MyProperty); var instance2 = SimpleIoc.Default.GetInstance<TestClass6>(); Assert.NotNull(instance2); Assert.NotNull(instance2.MyProperty); Assert.Same(property, instance2.MyProperty); }
public void TestBuildInstanceWithMultipleConstructorsNotMarkedWithAttribute() { var property = new TestClass1(); SimpleIoc.Default.Reset(); SimpleIoc.Default.Register(() => new TestClass6(property)); var instance1 = new TestClass6(); Assert.NotNull(instance1); Assert.Null(instance1.MyProperty); var instance2 = SimpleIoc.Default.GetInstance<TestClass6>(); Assert.NotNull(instance2); Assert.NotNull(instance2.MyProperty); Assert.Same(property, instance2.MyProperty); }