public void Instanciate_InterfaceIsNotRegistered_ThrowArgumentException() { var registry = new DependancyRegistry(); void testAction() => registry.Instantiate <ITestedInterface>(); Assert.ThrowsException <ArgumentException>(testAction); }
public void Instanciate_NotInterface_ThrowArgumentException() { var registry = new DependancyRegistry(); void testAction() => registry.Instantiate <TestedInheritingClass>(); Assert.ThrowsException <ArgumentException>(testAction); }
public void Instanciate_InterfaceIsRegistered_ReturnsNewImplementation() { var registry = new DependancyRegistry(); registry.Register(typeof(ITestedInterface), typeof(TestedInheritingClass)); var instance = registry.Instantiate <ITestedInterface>(); Assert.IsTrue(instance is TestedInheritingClass); }