예제 #1
0
        public void when_preference_does_match_productattribute_then_match()
        {
            var housePrice = new MetaAttributeBuilder().HousePrice(); // Currency / Range

            var product = new ProductBuilder().Product440000;
            var buyer = new BuyerBuilder().Build();
            buyer.Preferences.Add(new PreferenceBuilder().WithMetaAttribute(housePrice).WithRawValues("30000000-45000000").Build());
            Assert.IsTrue(buyer.IsMatch(product));
        }
예제 #2
0
        public void when_product_has_no_productattributes_then_everything_matches()
        {
            var products = new ProductBuilder().GetCollectionOfProductsWithNoProductAttributes().ToList();
            var buyer = new BuyerBuilder().Build();

            products.ForEach(p => Assert.IsTrue(buyer.IsMatch(p)));

            buyer.Preferences.Add(new PreferenceBuilder().WithMetaAttribute(new MetaAttributeBuilder().HousePrice()).Build());
            products.ForEach(p => Assert.IsTrue(buyer.IsMatch(p)));
        }