示例#1
0
        public virtual ApiSalesTerritoryResponseModel MapBOToModel(
            BOSalesTerritory boSalesTerritory)
        {
            var model = new ApiSalesTerritoryResponseModel();

            model.SetProperties(boSalesTerritory.TerritoryID, boSalesTerritory.CostLastYear, boSalesTerritory.CostYTD, boSalesTerritory.CountryRegionCode, boSalesTerritory.@Group, boSalesTerritory.ModifiedDate, boSalesTerritory.Name, boSalesTerritory.Rowguid, boSalesTerritory.SalesLastYear, boSalesTerritory.SalesYTD);

            return(model);
        }
        public void MapResponseToRequest()
        {
            var mapper = new ApiSalesTerritoryModelMapper();
            var model  = new ApiSalesTerritoryResponseModel();

            model.SetProperties(1, 1m, 1m, "A", "A", DateTime.Parse("1/1/1987 12:00:00 AM"), "A", Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), 1m, 1m);
            ApiSalesTerritoryRequestModel response = mapper.MapResponseToRequest(model);

            response.CostLastYear.Should().Be(1m);
            response.CostYTD.Should().Be(1m);
            response.CountryRegionCode.Should().Be("A");
            [email protected]().Be("A");
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Name.Should().Be("A");
            response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
            response.SalesLastYear.Should().Be(1m);
            response.SalesYTD.Should().Be(1m);
        }