public void InstanceReturnsNullForOtherObjectTypes() { TestableGetInstanceForm form = new TestableGetInstanceForm(typeof(ConcreteClass)); form.OnObjectCreated(new OtherTypeOfObject()); Assert.IsNull(form.Instance); }
public void InstanceReturnsTypesThatImplementAnInterface() { TestableGetInstanceForm form = new TestableGetInstanceForm(typeof(IInterface)); MyInterface implementor = new MyInterface(); form.OnObjectCreated(implementor); Assert.AreSame(implementor, form.Instance); }
public void InstanceReturnsDerivedTypes() { TestableGetInstanceForm form = new TestableGetInstanceForm(typeof(ConcreteClass)); DerivedClass derived = new DerivedClass(); form.OnObjectCreated(derived); Assert.AreSame(derived, form.Instance); }