/// <summary>
        /// Recalculates the order.
        /// </summary>
        /// <param name="order">The order.</param>
        protected virtual void RecalculateOrder(DomainModel.Orders.Order order)
        {
            if (order == null)
            {
                return;
            }

            OrderPriceCalculator manager = Context.Entity.Resolve <OrderPriceCalculator>();

            manager.Recalculate(ref order);

            this.OrderManager.SaveOrder(order);
        }
Example #2
0
        public void ShouldThrowOnInvalidOutputCurrency()
        {
            var priceCalculator = new OrderPriceCalculator();
            var orderItems      = new List <OrderItem>()
            {
                new OrderItem()
                {
                    ItemName = "test item 1", CurrencyCode = "PLN", Price = 1400
                },
                new OrderItem()
                {
                    ItemName = "test item 2", CurrencyCode = "PLN", Price = 100
                }
            };
            var client = new Client()
            {
                BirthDate = new DateTime(1999, 1, 1), IsPremiumMebmer = true
            };

            priceCalculator.CalculateOrderTotalPrice(Guid.NewGuid(), orderItems, client, "AUD");
        }
Example #3
0
        public void ShouldNotApplyPremiumMemberDiscountForOrdersUnderOrEqualTo1500PLN()
        {
            var priceCalculator = new OrderPriceCalculator();
            var orderItems      = new List <OrderItem>()
            {
                new OrderItem()
                {
                    ItemName = "test item 1", CurrencyCode = "PLN", Price = 1400
                },
                new OrderItem()
                {
                    ItemName = "test item 2", CurrencyCode = "PLN", Price = 100
                }
            };
            var client = new Client()
            {
                BirthDate = new DateTime(1999, 1, 1), IsPremiumMebmer = true
            };

            var totalPrice = priceCalculator.CalculateOrderTotalPrice(Guid.NewGuid(), orderItems, client, "PLN");

            Assert.AreEqual((orderItems[0].Price + orderItems[1].Price), totalPrice);
        }