Exemplo n.º 1
0
        public void AreItemsInCategory_EmptyProduct_Failed()
        {
            // Arrange
            var context = new AssociationExpressionEvaluationContext()
            {
                Products = new[]
                {
                    new CatalogProduct {
                    },
                }
            };
            var categoryIds = new string[] { "noMatches" };

            // Act
            var result = context.AreItemsInCategory(categoryIds);

            // Assert
            Assert.False(result);
        }
Exemplo n.º 2
0
        public void AreItemsInCategory_MatchesCategoryId_Succeeded()
        {
            // Arrange
            var context = new AssociationExpressionEvaluationContext()
            {
                Products = new[]
                {
                    new CatalogProduct
                    {
                        CategoryId = "cat1",
                    }
                }
            };
            var categoryIds = new string[] { "cat1" };

            // Act
            var result = context.AreItemsInCategory(categoryIds);

            // Assert
            Assert.True(result);
        }
Exemplo n.º 3
0
        public void AreItemsInCategory_NotMatchingOutline_Failed()
        {
            // Arrange
            var context = new AssociationExpressionEvaluationContext()
            {
                Products = new[]
                {
                    new CatalogProduct
                    {
                        Outlines = new []
                        {
                            new Outline()
                            {
                                Items = new []
                                {
                                    new OutlineItem()
                                    {
                                        Id = "outerCat"
                                    },
                                    new OutlineItem()
                                    {
                                        Id = "innerCat"
                                    },
                                },
                            }
                        },
                    },
                }
            };
            var categoryIds = new string[] { "noMatches" };

            // Act
            var result = context.AreItemsInCategory(categoryIds);

            // Assert
            Assert.False(result);
        }