コード例 #1
0
        public List <CourseViewModel> List()
        {
            var course = this.dataAccess.List();

            List <CourseViewModel> models = config.ConvertModel <List <Course>, List <CourseViewModel> >(course);

            return(models);
        }
コード例 #2
0
        public void Test_Automapper_Extension()
        {
            InitMapperConfig();

            SourceModel source = new SourceModel();

            source.Name  = "Binodata";
            source.Price = 10000000000;

            var destModel = config.ConvertModel(source, new DestModel());


            string expectedName  = "Binodata";
            long   expectedPrice = 10000000000;

            Assert.AreEqual(expectedName, destModel.Name);
            Assert.AreEqual(expectedPrice, destModel.Price);
        }