public void IsSatisfiedBy_ConfigurablePartsIsEmpty_False()
        {
            // arrange
            var partItemFaker = new Faker <Product>()
                                .RuleFor(p => p.ProductType, f => ProductTypes.Physical);

            var partFaker = new Faker <ProductPart>()
                            .RuleFor(p => p.Items, f => partItemFaker.Generate(Rand.Int(1, 5)).ToArray());

            var productFaker = new Faker <Product>()
                               .RuleFor(p => p.ProductType, f => ProductTypes.Configurable)
                               .RuleFor(p => p.Parts, f => partFaker.Generate(Rand.Int(1, 5)).ToArray());

            var product = productFaker.Generate();

            product.Parts = Array.Empty <ProductPart>();

            var spec = new ProductIsBuyableSpecification();

            // act
            var result = spec.IsSatisfiedBy(product);

            // assert
            Assert.False(result);
        }
        public void IsSatisfiedBy_NotConfigurable_False(bool isActive, bool isBuyable, int priceMin, int priceMax)
        {
            // arrange
            var product = new Product()
            {
                ProductType = ProductTypes.Physical,
                IsActive    = isActive,
                IsBuyable   = isBuyable,
                Price       = new ProductPrice(Usd)
                {
                    ListPrice = new Money(Rand.Decimal(priceMin, priceMax), Usd)
                }
            };

            var spec = new ProductIsBuyableSpecification();

            // act
            var result = spec.IsSatisfiedBy(product);

            // assert
            Assert.False(result);
        }
        public void IsSatisfiedBy_NotConfigurable_True()
        {
            // arrange
            var product = new Product()
            {
                ProductType = ProductTypes.Physical,
                IsActive    = true,
                IsBuyable   = true,
                Price       = new ProductPrice(Usd)
                {
                    ListPrice = new Money(Rand.Decimal(1), Usd)
                }
            };

            var spec = new ProductIsBuyableSpecification();

            // act
            var result = spec.IsSatisfiedBy(product);

            // assert
            Assert.True(result);
        }