Ejemplo n.º 1
0
        public void Configure()
        {
            var mappingEngine = new SimpleMappingEngine(this.container.Resolve <IServiceLocator>());

            // Register in the container for consumers););
            this.container.RegisterInstance(typeof(IMappingEngine), mappingEngine);

            // Contract -> Domain

            // Domain -> Contract
            mappingEngine.RegisterMap(new SystemDataMapper());
            mappingEngine.RegisterMap(new EntityMappingMapper());
        }
        public void Configure()
        {
            var mappingEngine = new SimpleMappingEngine(this.container.Resolve<IServiceLocator>());

            // Register in the container for consumers););
            this.container.RegisterInstance(typeof(IMappingEngine), mappingEngine);

            // Contract -> Domain

            // Domain -> Contract
            mappingEngine.RegisterMap(new SystemDataMapper());
            mappingEngine.RegisterMap(new EntityMappingMapper());
        }
        public void RegisteredMapperIsReturned()
        {
            var locator = new Mock<IServiceLocator>(MockBehavior.Strict);
            var engine = new SimpleMappingEngine(locator.Object);

            engine.RegisterMap(new AnimalAnimalModelMapper());

            var candidate = engine.Mapper<Animal, AnimalModel>();

            Assert.IsNotNull(candidate);
        }
Ejemplo n.º 4
0
        public void RegisteredMapperIsReturned()
        {
            var locator = new Mock <IServiceLocator>(MockBehavior.Strict);
            var engine  = new SimpleMappingEngine(locator.Object);

            engine.RegisterMap(new AnimalAnimalModelMapper());

            var candidate = engine.Mapper <Animal, AnimalModel>();

            Assert.IsNotNull(candidate);
        }
        public void MapCreatesDestination()
        {
            var locator = new Mock<IServiceLocator>(MockBehavior.Strict);
            var engine = new SimpleMappingEngine(locator.Object);

            engine.RegisterMap(new AnimalAnimalModelMapper());

            var source = new Animal { Id = 1, Name = "Test" };
            var expected = new AnimalModel { Id = 1, Name = "Test" };            

            var candidate = engine.Map<Animal, AnimalModel>(source);

            this.Check(expected, candidate);
        }
Ejemplo n.º 6
0
        public void MapCreatesDestination()
        {
            var locator = new Mock <IServiceLocator>(MockBehavior.Strict);
            var engine  = new SimpleMappingEngine(locator.Object);

            engine.RegisterMap(new AnimalAnimalModelMapper());

            var source = new Animal {
                Id = 1, Name = "Test"
            };
            var expected = new AnimalModel {
                Id = 1, Name = "Test"
            };

            var candidate = engine.Map <Animal, AnimalModel>(source);

            this.Check(expected, candidate);
        }