Ejemplo n.º 1
0
        public void ApplyVoucherScopedToHatSubsetWithNoHats()
        {
            var cartItems = new List <Item>
            {
                GetShoesItem(),
                GetVoucherItem()
            };

            var response = VouchersController.ApplyVouchersItems(GetOfferVoucher5PoundsOffHats(), new List <GiftVoucher>(), cartItems);

            response.Item2.Should().Be("The basket does not contain 'Hat Group' items. Voucher with code '5POUNDSOFFHATS' cannot be applied");
        }
Ejemplo n.º 2
0
        public void ApplyOfferVoucherWhenBasketDoesNotMeetMinBasketPrice()
        {
            var cartItems = new List <Item>
            {
                GetShoesItem(),
                GetVoucherItem()
            };

            var response = VouchersController.ApplyVouchersItems(GetOfferVoucher10Pounds(), new List <GiftVoucher>(), cartItems);

            response.Item2.Should().Be("The basket total £34.99 is less than the required £50. Voucher with code '10POUNDSOFF' cannot be applied");
        }
Ejemplo n.º 3
0
        public void ApplyNoVouchers()
        {
            var cartItems = new List <Item>
            {
                GetCapItem(),
                GetShoesItem(),
                GetVoucherItem()
            };

            var response = VouchersController.ApplyVouchersItems(null, new List <GiftVoucher>(), cartItems);

            response.Item1.Count().Should().Be(0);
            response.Item2.Should().BeNull();
        }
Ejemplo n.º 4
0
        public void ShouldNotApplyGiftVoucherToVoucherItemInCart()
        {
            var cartItems = new List <Item>
            {
                GetBeanieItem(),
                GetVoucherItem()
            };
            var response = VouchersController.ApplyVouchersItems(null, new List <GiftVoucher>
            {
                GetGiftVoucher10PoundsOff()
            }, cartItems);

            response.Item1.Should().BeEquivalentTo(new List <VoucherApplicationResponse>
            {
                new VoucherApplicationResponse
                {
                    Code        = "TENNEROFF",
                    Description = "Applied gift voucher with code 'TENNEROFF'",
                    Discount    = 5.99m
                }
            });
        }
Ejemplo n.º 5
0
        public void ApplyVoucherScopedToHatSubsetWithHats()
        {
            var cartItems = new List <Item>
            {
                GetCapItem(),
                GetShoesItem(),
                GetVoucherItem()
            };

            var response = VouchersController.ApplyVouchersItems(GetOfferVoucher5PoundsOffHats(), new List <GiftVoucher>(), cartItems);

            response.Item1.Should().BeEquivalentTo(new List <VoucherApplicationResponse>
            {
                new VoucherApplicationResponse
                {
                    Code        = "5POUNDSOFFHATS",
                    Discount    = 5,
                    Description = "Applied offer voucher with code '5POUNDSOFFHATS'"
                }
            });
            response.Item2.Should().BeNull();
        }