Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }