Exemplo n.º 1
0
        public void Map_SpecifyDestinationTypeOnly_ReturnsMappedDestinationObject()
        {
            // Arrange
            var srcObj = new SourceObject()
            {
                Id       = 1,
                Name     = "map model service",
                Create   = new DateTime(2000, 1, 1),
                Children = new List <string>()
                {
                    "Child 1", "Child 2"
                }
            };

            var mapModelService = new MapModelService();

            Mapper.CreateMap <SourceObject, DestinationObject>();

            // Act
            var destObj = mapModelService.Map <DestinationObject>(srcObj);

            // Assert
            Assert.AreEqual(srcObj.Id, destObj.Id);
            Assert.AreEqual(srcObj.Name, destObj.Name);
            Assert.AreEqual(srcObj.Create, destObj.Create);
            Assert.AreEqual(srcObj.Children, destObj.Children);
        }
Exemplo n.º 2
0
        // GET: Home
        public ActionResult Index()
        {
            var homePage = ApplicationService.GetPageModel <HomePage>(DocTypeAliases.HomePage.Alias);

            return(View("HomePage", MapModelService.Map <HomePageViewModel>(homePage)));
        }