public override IEnumerable <Product> Filter(IEnumerable <Product> products) { var matchedColorProducts = ColorFilterSpecification.Filter(products); var matchedPriceProducts = PriceFilterSpecification.Filter(products); List <Product> matchedProducts = new List <Product>(matchedColorProducts.Concat(matchedPriceProducts).Distinct()); return(matchedProducts); }
public ColorPriceFilterSpecification(Color color, decimal price) { ColorFilterSpecification = new ColorFilterSpecification(color); PriceFilterSpecification = new PriceFilterSpecification(price); }
public void can_filter_by_color() { var colorFilterSpecification = new ColorFilterSpecification(Color.Green); _productFilter.FilterBy(colorFilterSpecification).Count().ShouldEqual(1); }
public void can_filter_by_color() { var colorFilterSpecification = new ColorFilterSpecification(Color.Green); _productFilter.FilterBy(colorFilterSpecification).Count().ShouldEqual(1); }
public ColorPriceFilterSpecification(Color color, decimal price) { ColorFilterSpecification = new ColorFilterSpecification(color); PriceFilterSpecification = new PriceFilterSpecification(price); }