Example #1
0
        public void ShouldBeTheTotalIfThereAreNoGiftCardsApplied()
        {
            var testableCartModel = new TestableCartModel(total: 100m)
            {
                AppliedGiftCards = new List <GiftCard>()
            };

            testableCartModel.TotalToPay.Should().Be(100m);
        }
Example #2
0
        public void PayPalShippingServiceTests_GetNoShipping_ShouldBe0WhenRequiresShippingAndAddressIsSet()
        {
            var testableCartModel = new TestableCartModel(requiresShipping: true)
            {
                ShippingAddress = new Address()
            };

            _payPalShippingService.GetNoShipping(testableCartModel).Should().Be("0");
        }
        public void IfShippingIsRequiredAndIsSetShouldBeShippingSet()
        {
            var cartModel = new TestableCartModel(requiresShipping: true)
            {
                ShippingMethod = A.Fake <IShippingMethod>()
            };

            cartModel.ShippingStatus.Should().Be(CartShippingStatus.ShippingSet);
        }
        public void IfShippingIsRequiredAndMethodNotSetAndNoPotentialMethodsShouldBeCannotShip()
        {
            var cartModel = new TestableCartModel(requiresShipping: true)
            {
                ShippingMethod = null,
                PotentiallyAvailableShippingMethods = new HashSet <IShippingMethod>()
            };

            cartModel.ShippingStatus.Should().Be(CartShippingStatus.CannotShip);
        }
Example #5
0
        public void ShouldBeTheTotalIfTheSumOfTheAvailableAmountIsGreaterThanTheTotal()
        {
            var testableCartModel = new TestableCartModel(total: 50m)
            {
                AppliedGiftCards = new List <GiftCard>
                {
                    new GiftCardBuilder().WithAvailableAmount(10m).Build(),
                    new GiftCardBuilder().WithAvailableAmount(20m).Build(),
                    new GiftCardBuilder().WithAvailableAmount(30m).Build()
                }
            };

            testableCartModel.GiftCardAmount.Should().Be(50m);
        }
Example #6
0
        public void ShouldBeTheSumOfTheAvailableAmountOfTheGiftCardsApplied()
        {
            var testableCartModel = new TestableCartModel(total: 100m)
            {
                AppliedGiftCards = new List <GiftCard>
                {
                    new GiftCardBuilder().WithAvailableAmount(10m).Build(),
                    new GiftCardBuilder().WithAvailableAmount(20m).Build(),
                    new GiftCardBuilder().WithAvailableAmount(30m).Build()
                }
            };

            testableCartModel.GiftCardAmount.Should().Be(60m);
        }
Example #7
0
        public void ShouldBeTheSumOfTheItemsPriceLessTheOrderTotalDiscount()
        {
            var model = new TestableCartModel(orderTotalDiscount: 10m)
            {
                Items = new List <CartItem>
                {
                    new CartItemBuilder().WithPricePreTax(10).WithTax(5).Build(),
                    new CartItemBuilder().WithPricePreTax(20).WithTax(5).Build(),
                    new CartItemBuilder().WithPricePreTax(30).WithTax(5).Build()
                }
            };

            model.TotalPreShipping.Should().Be(65);
        }
        public void ShouldBeOrderTotalDiscountPlusItemTotalIfThatAmountIsLessThanTHeOrderTotalPreDiscount()
        {
            var cartModel = new TestableCartModel(totalPreDiscount: 20m, orderTotalDiscount: 10m, itemDiscount: 5m);

            cartModel.DiscountAmount.Should().Be(15m);
        }
Example #9
0
        public void ShouldBeShippingTotalLessTax()
        {
            var cartModel = new TestableCartModel(shippingTotal: 10m, shippingTax: 1m);

            cartModel.ShippingPreTax.Should().Be(9m);
        }
Example #10
0
        public void ShouldBeTheTotalLessTheAppliedGiftCardAvailableAmount()
        {
            var testableCartModel = new TestableCartModel(total: 100m, giftCardAmount: 60m);

            testableCartModel.TotalToPay.Should().Be(40m);
        }
        public void ShouldBeTheItemTaxPlusTheShippingTax()
        {
            var model = new TestableCartModel(itemTax: 10m, shippingTax: 5m);

            model.Tax.Should().Be(15);
        }
        public void IfShippingIsNotRequiredStatusShouldBeNotRequired()
        {
            var cartModel = new TestableCartModel(requiresShipping: false);

            cartModel.ShippingStatus.Should().Be(CartShippingStatus.ShippingNotRequired);
        }
Example #13
0
        public void ShouldBeTheTotalPreShippingPlusTheShippingTotal()
        {
            var model = new TestableCartModel(totalPreShipping: 10m, shippingTotal: 5m);

            model.Total.Should().Be(15);
        }