Example #1
0
        public void IfRestrictedShippingAndCartModelAndProductVariantHaveMatchingShippingMethodsCanShip()
        {
            var method = new StubShippingMethod1();
            var productVariant = new ProductVariantBuilder().WithRestrictedShipping(method.TypeName).Build();
            var cartModel = new CartModelBuilder().WithShippingOptions(method).Build();
            var productShippingChecker = new ProductShippingCheckerBuilder().WithCartModel(cartModel).Build();

            productShippingChecker.CanShip(productVariant).Should().BeTrue();
        }
Example #2
0
        public void IfRestrictedShippingAndCartModelAndProductVariantHaveNoSharedShippingMethodsCannotShip()
        {
            var method1 = new StubShippingMethod1();
            var method2 = new StubShippingMethod2();
            var productVariant = new ProductVariantBuilder().WithRestrictedShipping(method1.TypeName).Build();
            var cartModel = new CartModelBuilder().WithShippingOptions(method2).Build();
            var productShippingChecker = new ProductShippingCheckerBuilder().WithCartModel(cartModel).Build();

            productShippingChecker.CanShip(productVariant).Should().BeFalse();
        }
        public void CartModel_CanCheckout_IfAllItemsCanBeBoughtThenReturnsTrue()
        {
            var cartItem = new CartItemBuilder().CanBuy().Build();
            var cartModel = new CartModelBuilder().WithItems(cartItem).Build();

            var canCheckout = cartModel.CanCheckout;

            canCheckout.Should().BeTrue();
        }