public void test_find_by_color_size_and_below_price() { var andSpec = new AndSpec(new ColorSpec(Color.Red), new SizeSpec(ProductSize.SMALL), new BelowPriceSpec(10.00F)); var products = finder.SelectBy(andSpec); Assert.Equal(0, products.Count); var andSpec1 = new AndSpec(new ColorSpec(Color.Red), new SizeSpec(ProductSize.MEDIUM), new BelowPriceSpec(10.00F)); products = finder.SelectBy(andSpec1); Assert.Equal(1, products.Count); Assert.Equal(fireTruck, products.ElementAt(0)); }
public void test_find_by_below_price_and_avoid_a_color() { var andSpec = new AndSpec(new NotSpec(new ColorSpec(Color.White)), new BelowPriceSpec(9.00f)); var products = finder.SelectBy(andSpec); Assert.Equal(1, products.Count); Assert.Equal(fireTruck, products.ElementAt(0)); var andSpec1 = new AndSpec(new NotSpec(new ColorSpec(Color.Red)), new BelowPriceSpec(9.00f)); products = finder.SelectBy(andSpec1); Assert.Equal(1, products.Count); Assert.Equal(baseball, products.ElementAt(0)); }