public void AreItemPropertyValuesEqual_MultiPropertyValueMutliConditionValue_Succeeded() { // Arrange var context = new AssociationExpressionEvaluationContext() { Products = new[] { new CatalogProduct { Properties = new [] { new Property() { Name = "DictionaryProperty", Dictionary = true, Values = new [] { new PropertyValue() { Value = "Elem1", Alias = "Elem1", ValueId = "Elem1Id", }, new PropertyValue() { Value = "Elem2", Alias = "Elem2", ValueId = "Elem2Id", }, } } }, } } }; var valuesToMatch = new Dictionary <string, string[]> { { "DictionaryProperty", new[] { "Elem1", "Elem3" } } }; // Act var result = context.AreItemPropertyValuesEqual(valuesToMatch); // Assert Assert.True(result); }
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); }
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); }
public void AreItemPropertyValuesEqual_MutliPropertyValueSingleConditionValue_Succeeded() { // Arrange var context = new AssociationExpressionEvaluationContext() { Products = new[] { new CatalogProduct { Properties = new [] { new Property() { Name = "IntProperty", Values = new [] { new PropertyValue() { Value = 1 }, new PropertyValue() { Value = 2 }, } } }, } } }; var valuesToMatch = new Dictionary <string, string[]> { { "IntProperty", new[] { "1" } } }; // Act var result = context.AreItemPropertyValuesEqual(valuesToMatch); // Assert Assert.True(result); }
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); }
public void AreItemPropertyValuesEqual_DifferentPropertyValue_Failed() { // Arrange var context = new AssociationExpressionEvaluationContext() { Products = new[] { new CatalogProduct { Properties = new [] { new Property() { Name = "IntProperty", Values = new [] { new PropertyValue() { Value = 1 } } } }, } } }; var valuesToMatch = new Dictionary <string, string[]> { { "IntProperty", new[] { "2" } } }; // Act var result = context.AreItemPropertyValuesEqual(valuesToMatch); // Assert Assert.False(result); }