public void Throws_Exception_If_Type_Not_Found() { var registry = new SimpleTypeRegistry(); Assert.Throws <TypeNotRegisteredException>(() => registry.Find( typeof(int))); }
public void Replaces_Existing_Entry() { var registry = new SimpleTypeRegistry(); registry.Register(typeof(IEmptyInteface), typeof(ConcreteClassImplementingEmptyInterface)); Assert.Equal(typeof(ConcreteClassImplementingEmptyInterface), registry.Find(typeof(IEmptyInteface))); registry.Register(typeof(IEmptyInteface), typeof(AlternativeConcreteClassImplementingEmptyInterface)); Assert.Equal(typeof(AlternativeConcreteClassImplementingEmptyInterface), registry.Find(typeof(IEmptyInteface))); }
public void Returns_Specific_Type_When_Asked_For_General_Type() { var registry = new SimpleTypeRegistry(); registry.Register(typeof(IEmptyInteface), typeof(ConcreteClassImplementingEmptyInterface)); var concreteType = registry.Find(typeof(IEmptyInteface)); Assert.Equal(typeof(ConcreteClassImplementingEmptyInterface), concreteType); }