Example #1
0
        public void CartIsInitiallyEmpty()
        {
            var services = CartServiceContext.GivenServices();

            var cart = services.WhenLoadCart();

            cart.CartItems.Count().Should().Be(0);
        }
Example #2
0
        public void DoNotApplyDiscountToNonLoyaltyCardHolders()
        {
            var services = CartServiceContext.GivenServices();
            var cart     = services.WhenLoadCart();

            services.WhenAddItemToCart(cart);

            cart.CartItems.Should().ContainSingle()
            .Which.ItemTotal.Should().Be(18.80m);
        }
Example #3
0
        public void CanAddItemToCart()
        {
            var services = CartServiceContext.GivenServices();

            var cart = services.WhenLoadCart();

            services.WhenAddItemToCart(cart);

            cart.CartItems.Count().Should().Be(1);
        }
Example #4
0
        public void CanLoadCartWithOneItem()
        {
            var services = CartServiceContext.GivenServices();

            InitializeCartWithOneItem(services.EmailAddress);

            var cart = services.WhenLoadCart();

            cart.CartItems.Count().Should().Be(1);
            cart.CartItems.Single().Quantity.Should().Be(2);
        }
Example #5
0
        public void ApplyDiscountToLoyaltyCardHolders()
        {
            var services = CartServiceContext.GivenServices();

            InitializeUserWithLoyaltyCard(services.EmailAddress);
            var cart = services.WhenLoadCart();

            services.WhenAddItemToCart(cart);

            cart.CartItems.Should().ContainSingle()
            .Which.ItemTotal.Should().Be(0.9m * 18.80m);
        }
Example #6
0
        public void GroupItemsOfSameKind()
        {
            var services = CartServiceContext.GivenServices();

            var cart = services.WhenLoadCart();

            services.WhenAddItemToCart(cart, quantity: 2);
            services.WhenAddItemToCart(cart, quantity: 1);

            cart.CartItems.Count().Should().Be(1);
            cart.CartItems.Single().Quantity.Should().Be(3);
        }