private ImplTypeFactories GetFactory() { var typeMap = new Dictionary<Type, Type>(); typeMap.Add(typeof(IImplTypeFactory), typeof(MappingImplTypeFactory)); var factory1 = new MappingImplTypeFactory(typeMap); var factory2 = new ImplementationAttributeImplTypeFactory(); var actor = new ImplTypeFactories(); actor.AddFactory(factory1); actor.AddFactory(factory2); return actor; }
public void TestGetImplTypeNotRegisterdType() { // Arrange var typeMap = new Dictionary<Type, Type>(); typeMap.Add(typeof(IImplTypeFactory), typeof(MappingImplTypeFactory)); var actor = new MappingImplTypeFactory(typeMap); // Act var actual = actor.GetImplType(typeof(IInstanceFactory)); // Assert Assert.IsNull(actual); }
public void TestGetImplType() { // Arrange var typeMap = new Dictionary<Type, Type>(); typeMap.Add(typeof(IImplTypeFactory), typeof(MappingImplTypeFactory)); var actor = new MappingImplTypeFactory(typeMap); // Act var actual = actor.GetImplType(typeof(IImplTypeFactory)); // Assert Assert.AreEqual(typeof(MappingImplTypeFactory), actual); }
public void TestDispose() { // Arrange var typeMap = new Dictionary<Type, Type>(); typeMap.Add(typeof(IImplTypeFactory), typeof(MappingImplTypeFactory)); var actor = new MappingImplTypeFactory(typeMap); // Act actor.Dispose(); var actual = actor.GetImplType(typeof(MappingImplTypeFactory)); // Assert Assert.IsNull(actual); }