Ejemplo n.º 1
0
        public void IfTheStockLevelIsBelowTheRequestedAmountItShouldBeReturned()
        {
            ProductVariant productVariant = new ProductVariantBuilder().Build();
            ProductStockChecker productStockChecker = new ProductStockCheckerBuilder().StockRemaining(1).Build();

            productStockChecker.CanOrderQuantity(productVariant, 2).StockRemaining.Should().Be(1);
        }
Ejemplo n.º 2
0
        public void IfStockIsTrackedAVariantWithEqualOrMoreThanTheRequestedAmountShouldBeAvailable(int remaining)
        {
            ProductVariant productVariant = new ProductVariantBuilder().Build();
            ProductStockChecker productStockChecker = new ProductStockCheckerBuilder().StockRemaining(remaining).Build();

            productStockChecker.CanOrderQuantity(productVariant, 2).CanOrder.Should().BeTrue();
        }
Ejemplo n.º 3
0
        public void IfStockIsTrackedAVariantWithLessThanTheRequestedAmountShouldNotBeAvailable()
        {
            ProductVariant productVariant = new ProductVariantBuilder().StockRemaining(1).Build();
            ProductStockChecker productStockChecker = new ProductStockCheckerBuilder().Build();

            productStockChecker.CanOrderQuantity(productVariant, 2).CanOrder.Should().BeFalse();
        }
Ejemplo n.º 4
0
        public void UntrackedVariantsAreAvailableInAnyQuantity()
        {
            ProductVariant productVariant = new ProductVariantBuilder().DoNotTrackStock().Build();
            ProductStockChecker productStockChecker = new ProductStockCheckerBuilder().Build();

            productStockChecker.CanOrderQuantity(productVariant, 999).CanOrder.Should().BeTrue();
        }
Ejemplo n.º 5
0
        public void IfStockIsTrackedAVariantWithSomeStockRemainingStockShouldBeInStock()
        {
            ProductVariant productVariant = new ProductVariantBuilder().StockRemaining(1).Build();
            ProductStockChecker productStockChecker = new ProductStockCheckerBuilder().StockRemaining(1).Build();

            productStockChecker.IsInStock(productVariant).Should().BeTrue();
        }
Ejemplo n.º 6
0
        public void IfStockIsTrackedAVariantWithZeroRemainingStockShouldNotBeInStock()
        {
            ProductVariant productVariant = new ProductVariantBuilder().Build();
            ProductStockChecker productStockChecker = new ProductStockCheckerBuilder().StockRemaining(0).Build();

            productStockChecker.IsInStock(productVariant).Should().BeFalse();
        }
Ejemplo n.º 7
0
        public void UntrackedVariantsAreAlwaysInStock()
        {
            ProductVariant productVariant = new ProductVariantBuilder().DoNotTrackStock().Build();
            ProductStockChecker productStockChecker = new ProductStockCheckerBuilder().Build();

            productStockChecker.IsInStock(productVariant).Should().BeTrue();
        }