Пример #1
0
        public void MapEntityToModelList()
        {
            var     mapper = new DALProductMapper();
            Product item   = new Product();

            item.SetProperties(1, true, "A", "A", 1m, 1);
            List <ApiProductServerResponseModel> response = mapper.MapEntityToModel(new List <Product>()
            {
                { item }
            });

            response.Count.Should().Be(1);
        }
Пример #2
0
        public void MapModelToEntity()
        {
            var mapper = new DALProductMapper();
            ApiProductServerRequestModel model = new ApiProductServerRequestModel();

            model.SetProperties(true, "A", "A", 1m, 1);
            Product response = mapper.MapModelToEntity(1, model);

            response.Active.Should().Be(true);
            response.Description.Should().Be("A");
            response.Name.Should().Be("A");
            response.Price.Should().Be(1m);
            response.Quantity.Should().Be(1);
        }
Пример #3
0
        public void MapEntityToModel()
        {
            var     mapper = new DALProductMapper();
            Product item   = new Product();

            item.SetProperties(1, true, "A", "A", 1m, 1);
            ApiProductServerResponseModel response = mapper.MapEntityToModel(item);

            response.Active.Should().Be(true);
            response.Description.Should().Be("A");
            response.Id.Should().Be(1);
            response.Name.Should().Be("A");
            response.Price.Should().Be(1m);
            response.Quantity.Should().Be(1);
        }