コード例 #1
0
        public void RemoveTransientRows()
        {
            var row = new PaymentInfoRowCarrier();

            var order = new OrderCarrier
            {
                PaymentInfo = new List <PaymentInfoCarrier>
                {
                    new PaymentInfoCarrier
                    {
                        Rows = new List <PaymentInfoRowCarrier>
                        {
                            new PaymentInfoRowCarrier(),
                            new PaymentInfoRowCarrier
                            {
                                CarrierState = new CarrierState
                                {
                                    IsMarkedForCreating = false
                                }
                            }
                        }
                    }
                }
            };


            sut.Create(order, null).ToList();

            Assert.Single(order.PaymentInfo.Single().Rows);
        }
コード例 #2
0
        public void MarkExistingRowsForDeleting()
        {
            var row = new PaymentInfoRowCarrier
            {
                CarrierState = new CarrierState
                {
                    IsMarkedForCreating = false
                }
            };

            var order = new OrderCarrier
            {
                PaymentInfo = new List <PaymentInfoCarrier>
                {
                    new PaymentInfoCarrier
                    {
                        Rows = new List <PaymentInfoRowCarrier>
                        {
                            row
                        }
                    }
                }
            };


            sut.Create(order, null).ToList();

            Assert.True(row.CarrierState.IsMarkedForDeleting);
        }
        public static PaymentInfoRowCarrier Build(OrderDiscountCarrier discount, Guid paymentInfoID, int index)
        {
            var result = new PaymentInfoRowCarrier(discount, paymentInfoID, index);

            result.TotalPrice     = Math.Abs(discount.DiscountAmount) * -1;
            result.TotalVatAmount = Math.Abs(discount.VATAmount) * -1;
            return(result);
        }
        public static PaymentInfoRowCarrier Build(FeeCarrier fee, Guid paymentInfoID, int index)
        {
            var result = new PaymentInfoRowCarrier(fee, paymentInfoID, index);

            result.TotalPrice     = Math.Abs(fee.TotalAmount);
            result.TotalVatAmount = Math.Abs(fee.TotalVATAmount);
            return(result);
        }
        public static PaymentInfoRowCarrier Build(DeliveryCarrier delivery, string description, Guid paymentInfoID, int index)
        {
            var result = new PaymentInfoRowCarrier(delivery, description, paymentInfoID, index);

            result.TotalPrice     = Math.Abs(delivery.TotalDeliveryCost);
            result.TotalVatAmount = Math.Abs(delivery.TotalVATAmount);
            return(result);
        }
        public static PaymentInfoRowCarrier Build(OrderRowCarrier row, Guid paymentInfoID, int index)
        {
            var result = new PaymentInfoRowCarrier(row, paymentInfoID, index);

            result.TotalPrice     = Math.Abs(row.TotalPrice);
            result.TotalVatAmount = Math.Abs(row.TotalVATAmount);
            return(result);
        }