Пример #1
0
        public void PaymentsAppliedIsNotNullEvenWhenExplicitlyNullified()
        {
            var order = new Falcon.App.Core.Finance.Domain.Order {
                PaymentsApplied = null
            };

            Assert.IsNotNull(order.OrderDetails, "PaymentsApplied remained null after nullification.");
        }
Пример #2
0
        public void OrderDetailsIsNotNullEvenWhenExplicitlyNullified()
        {
            var order = new Falcon.App.Core.Finance.Domain.Order {
                OrderDetails = null
            };

            Assert.IsNotNull(order.OrderDetails, "OrderDetail collection remained null after nullification.");
        }
Пример #3
0
        public void TotalAmountPaidReturns0WhenPaymentsAppliedIsEmpty()
        {
            const decimal expectedTotalAmountPaid = 0m;

            var order = new Falcon.App.Core.Finance.Domain.Order {
                PaymentsApplied = new List <PaymentInstrument>()
            };

            Assert.AreEqual(expectedTotalAmountPaid, order.TotalAmountPaid);
        }
Пример #4
0
        public void OrderStatusIsEmptyWhenOrderDetailCollectionIsEmpty()
        {
            const OrderStatus expectedOrderStatus = OrderStatus.Empty;
            var orderDetails = new List <OrderDetail>();

            var order = new Falcon.App.Core.Finance.Domain.Order {
                OrderDetails = orderDetails
            };

            Assert.AreEqual(expectedOrderStatus, order.OrderStatus, "Order's OrderStatus not Empty when empty OrderDetail collection given.");
        }
Пример #5
0
        public void OrderStatusIsOpenWhenOrderDetailCollectionContainsOneIncompleteOrder()
        {
            const OrderStatus expectedOrderStatus = OrderStatus.Open;
            var orderDetails = new List <OrderDetail> {
                new OrderDetail {
                    OrderItemStatus = FakeOrderItemStatus.IncompleteFakeStatus
                }
            };

            var order = new Falcon.App.Core.Finance.Domain.Order {
                OrderDetails = orderDetails
            };

            Assert.AreEqual(expectedOrderStatus, order.OrderStatus, "Order's OrderStatus not Open when single incomplete OrderDetail given.");
        }
Пример #6
0
        public void TotalAmountPaidReturns5DollarsWhenPaymentsAppliedHasOne5DollarPayment()
        {
            const decimal expectedTotalAmountPaid = 5m;
            var           paymentsApplied         = new List <PaymentInstrument> {
                new FakePaymentInstrument {
                    Amount = expectedTotalAmountPaid
                }
            };

            var order = new Falcon.App.Core.Finance.Domain.Order {
                PaymentsApplied = paymentsApplied
            };

            Assert.AreEqual(expectedTotalAmountPaid, order.TotalAmountPaid);
        }
Пример #7
0
        public void DiscountedTotalReturnsPriceOfOneOrderDetailWithNoDiscount()
        {
            const decimal expectedPrice = 15.00m;

            var orderDetails = new List <OrderDetail>
            {
                new OrderDetail
                {
                    Price = expectedPrice, OrderItemStatus = EventPackageItemStatus.Ordered
                }
            };

            var order = new Falcon.App.Core.Finance.Domain.Order {
                OrderDetails = orderDetails
            };
            decimal discountedTotal = order.DiscountedTotal;

            Assert.AreEqual(expectedPrice, discountedTotal);
        }
Пример #8
0
        public void TotalAmountPaidReturnsTotalOfThreeAppliedPayments()
        {
            var paymentsApplied = new List <PaymentInstrument>
            {
                new FakePaymentInstrument {
                    Amount = 3.44m
                },
                new FakePaymentInstrument {
                    Amount = 8.33m
                },
                new FakePaymentInstrument {
                    Amount = 99.10m
                }
            };
            decimal expectedTotalAmountPaid = paymentsApplied.Sum(pa => pa.Amount);

            var order = new Falcon.App.Core.Finance.Domain.Order {
                PaymentsApplied = paymentsApplied
            };

            Assert.AreEqual(expectedTotalAmountPaid, order.TotalAmountPaid);
        }
Пример #9
0
        public void OrderStatusIsOpenWhenOrderDetailCollectionHasAllCompleteOrders()
        {
            const OrderStatus expectedOrderStatus = OrderStatus.Closed;
            var orderDetails = new List <OrderDetail>
            {
                new OrderDetail {
                    OrderItemStatus = FakeOrderItemStatus.CompleteFakeStatus
                },
                new OrderDetail {
                    OrderItemStatus = FakeOrderItemStatus.CompleteFakeStatus
                },
                new OrderDetail {
                    OrderItemStatus = FakeOrderItemStatus.CompleteFakeStatus
                },
            };

            var order = new Falcon.App.Core.Finance.Domain.Order {
                OrderDetails = orderDetails
            };

            Assert.AreEqual(expectedOrderStatus, order.OrderStatus, "Order's OrderStatus not Closed when collection of completed OrderDetails given.");
        }
Пример #10
0
        public void UndiscountedTotalReturnsPriceOfSingleOrderDetailWithADiscount()
        {
            const decimal expectedPrice = 15.00m;

            var orderDetails = new List <OrderDetail>
            {
                new OrderDetail
                {
                    Price = expectedPrice,
                    SourceCodeOrderDetail = new SourceCodeOrderDetail {
                        Amount = 5m
                    },
                    OrderItemStatus = EventPackageItemStatus.Ordered
                }
            };

            var order = new Falcon.App.Core.Finance.Domain.Order {
                OrderDetails = orderDetails
            };
            decimal undiscountedTotal = order.UndiscountedTotal;

            Assert.AreEqual(expectedPrice, undiscountedTotal);
        }
Пример #11
0
        public void PaymentsAppliedIsInitializedOnObjectInstantiation()
        {
            var order = new Falcon.App.Core.Finance.Domain.Order();

            Assert.IsNotNull(order.PaymentsApplied, "PaymentsApplied not initialized upon Order instantiation.");
        }
Пример #12
0
        public void OrderDetailsIsInitializedOnObjectInstantiation()
        {
            var order = new Falcon.App.Core.Finance.Domain.Order();

            Assert.IsNotNull(order.OrderDetails, "OrderDetail collection not initialized upon Order instantiation.");
        }