public void DiscountAmountForOrder_TagsMatching_GivesDiscount()
        {
            var discount = DefaultFactoriesAndSharedFunctionality.CreateDefaultOrderDiscountWithPercentage(50);

            discount.AffectedProductTags = new[] { "schoen" };

            var amount = _discountCalculationService.DiscountAmountForOrder(discount, _order);

            Assert.AreEqual(500, amount);
        }
        public void Percentage()
        {
            var orderInfo = DefaultFactoriesAndSharedFunctionality.CreateOrderInfo(DefaultFactoriesAndSharedFunctionality.CreateProductInfo(1000, 1));
            var discount  = DefaultFactoriesAndSharedFunctionality.CreateDefaultOrderDiscountWithPercentage(50);

            DefaultFactoriesAndSharedFunctionality.SetDiscountsOnOrderInfo(orderInfo, discount);

            var actual = _discountCalculationService.DiscountAmountForOrder(discount, orderInfo);

            Assert.AreEqual(500, actual);
        }
Example #3
0
        public void DiscountWithMembergroupShouldGiveDiscountForUserInThatGroup()
        {
            // Arrange
            _mock.SetupGet(a => a.RolesForCurrentUser).Returns(new List <string> {
                "testGroup"
            });

            // Act
            var discountAmount = _discountCalculationService.DiscountAmountForOrder(_discount, _orderInfo);

            // Assert
            Assert.AreEqual(500, discountAmount);
        }
Example #4
0
        public void DiscountAmountForOrderOnOrderWithSingleProductAndApplicableNewPriceDiscount_ShouldGiveProductPriceMinusDiscountAmount()
        {
            var orderInfo = DefaultFactoriesAndSharedFunctionality.CreateOrderInfo(DefaultFactoriesAndSharedFunctionality.CreateProductInfo(1995, 1));
            var discount  = DefaultFactoriesAndSharedFunctionality.CreateDefaultOrderDiscountWithNewPrice(1000);

            DefaultFactoriesAndSharedFunctionality.SetDiscountsOnOrderInfo(orderInfo, discount);

            var actual = _discountCalculationService.DiscountAmountForOrder(discount, orderInfo);

            Assert.AreEqual(1995 - 1000, actual);
        }