コード例 #1
0
        public void RegisterTypes_SingletonConfiguration_MergedIntoOutput()
        {
            TestableUnityConfigProvider.AddSingletons(typeof(String));
            var types = new[] { typeof(TestableUnityConfigProvider) };

            // Act
            controller.RegisterTypes(MappingBehaviors.None, types);

            // Assert
            mappingFactory.Verify(mf => mf.CreateMappings(MappingBehaviors.None, It.Is <AutomapperConfig>(ac => ac.IsMarkedWithCustomLifetimeManager(typeof(String)).Item1), types));
        }
コード例 #2
0
        public void RegisterTypes_PolicyInjectionConfiguration_MergedIntoOutput()
        {
            TestableUnityConfigProvider.AddPolicyInjection(typeof(String));
            var types = new[] { typeof(TestableUnityConfigProvider) };

            // Act
            controller.RegisterTypes(MappingBehaviors.None, types);

            // Assert
            mappingFactory.Verify(mf => mf.CreateMappings(MappingBehaviors.None, It.Is <AutomapperConfig>(ac => ac.IsMarkedForPolicyInjection(typeof(String))), types));
        }
コード例 #3
0
        public void Setup()
        {
            target            = new Mock <IUnityContainer>();
            mappingFactory    = new Mock <ITypeMappingFactory>();
            internalContainer = new Mock <IUnityContainer>();
            mappingHandler    = new Mock <ITypeMappingHandler>();

            internalContainer.Setup(c => c.Resolve(typeof(ITypeMappingHandler), null, It.IsAny <ResolverOverride[]>())).Returns(mappingHandler.Object);
            controller = new MappingController(target.Object, mappingFactory.Object, internalContainer.Object);
            TestableUnityConfigProvider.Reset();
        }