public void LiteContainer_RegisterConcreteTypeTwice_ThrowsInvalidOperationException() { var c = new LiteContainer(); c.Register(() => new Number(2)); AssertThrowsExceptionOfType <InvalidOperationException>(() => c.Register(() => new Number(3))); }
public void LiteContainer_ResolveTypeAsInterface_CanResolveType() { var c = new LiteContainer(); c.Register <Person>(() => new Student("Jim")); var instance = c.Resolve <Person>(); Assert.AreEqual("Jim", instance.Name); }
public void LiteContainer_ResolveConcreteRegisteredType_TypeIsCorrect() { var c = new LiteContainer(); c.Register(() => new Number(2)); var instance = c.Resolve <Number>(); Assert.AreEqual(2, instance.Value); }