public void TestAddDefaultResolverType() { Mock<IRegistrationMap> mockRegistrationMap = new Mock<IRegistrationMap>(); Mock<PickRegistrationStrategy> mockRegistrationChain = new Mock<PickRegistrationStrategy>(); Mock<IResolverMap> mockResolverMap = new Mock<IResolverMap>(); Mock<FindResolverStrategy> mockResolverChain = new Mock<FindResolverStrategy>(); Mock<ILifetimeManagerMap> mockManagerMap = new Mock<ILifetimeManagerMap>(); Mock<FindLifetimeManagerStrategy> mockManagerChain = new Mock<FindLifetimeManagerStrategy>(); IocContainer testContainer = new IocContainer(mockRegistrationMap.Object, mockRegistrationChain.Object, mockResolverMap.Object, mockResolverChain.Object, mockManagerMap.Object, mockManagerChain.Object); Type resolverType = typeof(ResolverImpl); Type typeToResolve = typeof(object); testContainer.AddResolver(resolverType, typeToResolve); mockResolverMap.Verify(map => map.AddOrUpdate(typeToResolve, String.Empty, resolverType)); }
public void TestAddNamedResolverTypeGenerically() { Mock<IRegistrationMap> mockRegistrationMap = new Mock<IRegistrationMap>(); Mock<PickRegistrationStrategy> mockRegistrationChain = new Mock<PickRegistrationStrategy>(); Mock<IResolverMap> mockResolverMap = new Mock<IResolverMap>(); Mock<FindResolverStrategy> mockResolverChain = new Mock<FindResolverStrategy>(); Mock<ILifetimeManagerMap> mockManagerMap = new Mock<ILifetimeManagerMap>(); Mock<FindLifetimeManagerStrategy> mockManagerChain = new Mock<FindLifetimeManagerStrategy>(); IocContainer testContainer = new IocContainer(mockRegistrationMap.Object, mockRegistrationChain.Object, mockResolverMap.Object, mockResolverChain.Object, mockManagerMap.Object, mockManagerChain.Object); Type resolverType = typeof(ResolverImpl); Type typeToResolve = typeof(object); string identifier = "identifier"; testContainer.AddResolver<ResolverImpl, object>(identifier); mockResolverMap.Verify(map => map.AddOrUpdate(typeToResolve, identifier, resolverType)); }