Exemple #1
0
        public virtual ApiSalesOrderDetailResponseModel MapBOToModel(
            BOSalesOrderDetail boSalesOrderDetail)
        {
            var model = new ApiSalesOrderDetailResponseModel();

            model.SetProperties(boSalesOrderDetail.SalesOrderID, boSalesOrderDetail.CarrierTrackingNumber, boSalesOrderDetail.LineTotal, boSalesOrderDetail.ModifiedDate, boSalesOrderDetail.OrderQty, boSalesOrderDetail.ProductID, boSalesOrderDetail.Rowguid, boSalesOrderDetail.SalesOrderDetailID, boSalesOrderDetail.SpecialOfferID, boSalesOrderDetail.UnitPrice, boSalesOrderDetail.UnitPriceDiscount);

            return(model);
        }
        public void MapResponseToRequest()
        {
            var mapper = new ApiSalesOrderDetailModelMapper();
            var model  = new ApiSalesOrderDetailResponseModel();

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

            response.CarrierTrackingNumber.Should().Be("A");
            response.LineTotal.Should().Be(1m);
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.OrderQty.Should().Be(1);
            response.ProductID.Should().Be(1);
            response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
            response.SalesOrderDetailID.Should().Be(1);
            response.SpecialOfferID.Should().Be(1);
            response.UnitPrice.Should().Be(1m);
            response.UnitPriceDiscount.Should().Be(1m);
        }