예제 #1
0
        public virtual ApiSalesPersonResponseModel MapBOToModel(
            BOSalesPerson boSalesPerson)
        {
            var model = new ApiSalesPersonResponseModel();

            model.SetProperties(boSalesPerson.BusinessEntityID, boSalesPerson.Bonus, boSalesPerson.CommissionPct, boSalesPerson.ModifiedDate, boSalesPerson.Rowguid, boSalesPerson.SalesLastYear, boSalesPerson.SalesQuota, boSalesPerson.SalesYTD, boSalesPerson.TerritoryID);

            return(model);
        }
        public void MapResponseToRequest()
        {
            var mapper = new ApiSalesPersonModelMapper();
            var model  = new ApiSalesPersonResponseModel();

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

            response.Bonus.Should().Be(1m);
            response.CommissionPct.Should().Be(1m);
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
            response.SalesLastYear.Should().Be(1m);
            response.SalesQuota.Should().Be(1m);
            response.SalesYTD.Should().Be(1m);
            response.TerritoryID.Should().Be(1);
        }