public void ResoveConcreteClass() { // Given DIContainer container = new DIContainer(); container.Register <ConcreteB, ConcreteB>(); // When ConcreteB obj = container.Resolve <ConcreteB>(); // Then Assert.IsNotNull(obj); Assert.AreEqual(0, obj.IntValue); Assert.IsNull(obj.StrValue); Assert.AreEqual(MyEnum.A, obj.EnumValue); }
public void ResoveTwiceTest() { // Given DIContainer container = new DIContainer(); container.Register <ITestInterface, A>(); // When var objC1 = container.Resolve <C>(); var objC2 = container.Resolve <C>(); ConcreteB obj1 = container.Resolve <ConcreteB>(); ConcreteB obj2 = container.Resolve <ConcreteB>(); // Then Assert.IsNotNull(objC1); Assert.AreEqual(objC1, objC2); Assert.IsNotNull(obj1); Assert.AreEqual(obj1, obj2); }
public D(ITestInterface test, ConcreteB b, int v) : base(test, b) { m_value = v; }
public C(ITestInterface test, ConcreteB b) { TestObject = test; ConcreteBObject = b; }