Пример #1
0
        public void Ensure_order_can_only_be_refunded_offline_when_paymentstatus_is_paid()
        {
            var order = new Order
            {
                OrderTotal = 1
            };

            foreach (OrderStatus os in Enum.GetValues(typeof(OrderStatus)))
            {
                foreach (PaymentStatus ps in Enum.GetValues(typeof(PaymentStatus)))
                {
                    foreach (ShippingStatus ss in Enum.GetValues(typeof(ShippingStatus)))
                    {
                        order.OrderStatus    = os;
                        order.PaymentStatus  = ps;
                        order.ShippingStatus = ss;

                        if (ps == PaymentStatus.Paid)
                        {
                            _orderProcessingService.CanRefundOffline(order).ShouldBeTrue();
                        }
                        else
                        {
                            _orderProcessingService.CanRefundOffline(order).ShouldBeFalse();
                        }
                    }
                }
            }
        }
Пример #2
0
        public void EnsureOrderCanOnlyBeRefundedOfflineWhenPaymentStatusIsPaid()
        {
            var order = new Order
            {
                OrderTotal = 1
            };

            foreach (OrderStatus os in Enum.GetValues(typeof(OrderStatus)))
            {
                foreach (PaymentStatus ps in Enum.GetValues(typeof(PaymentStatus)))
                {
                    foreach (ShippingStatus ss in Enum.GetValues(typeof(ShippingStatus)))
                    {
                        order.OrderStatus    = os;
                        order.PaymentStatus  = ps;
                        order.ShippingStatus = ss;

                        if (ps == PaymentStatus.Paid)
                        {
                            _orderProcessingService.CanRefundOffline(order).Should().BeTrue();
                        }
                        else
                        {
                            _orderProcessingService.CanRefundOffline(order).Should().BeFalse();
                        }
                    }
                }
            }
        }