public void TestBuildInstanceWithMultipleConstructorsNotMarkedWithAttribute() { var property = new TestClass(); SimpleIoc.Default.Reset(); SimpleIoc.Default.Register<TestClass6>(() => new TestClass6(property)); var instance1 = new TestClass6(); Assert.IsNotNull(instance1); Assert.IsNull(instance1.MyProperty); var instance2 = SimpleIoc.Default.GetInstance<TestClass6>(); Assert.IsNotNull(instance2); Assert.IsNotNull(instance2.MyProperty); Assert.AreSame(property, instance2.MyProperty); }
public void TestConstructWithProperty() { var property = new TestClass(); SimpleIoc.Default.Reset(); SimpleIoc.Default.Register<TestClass6>(() => new TestClass6() { MyProperty = property }); var instance1 = new TestClass6(); Assert.IsNotNull(instance1); Assert.IsNull(instance1.MyProperty); var instance2 = SimpleIoc.Default.GetInstance<TestClass6>(); Assert.IsNotNull(instance2); Assert.IsNotNull(instance2.MyProperty); Assert.AreSame(property, instance2.MyProperty); }