Пример #1
0
        public void AllFeaturesProductsDoesNotFindProductsWithAllContainingFeatures()
        {
            var snickersFeatures = new List <Feature> {
                new Feature(251), new Feature(247)
            };
            var snickers       = new FeatureProduct("Snickers", snickersFeatures);
            var bountyFeatures = new List <Feature> {
                new Feature(240), new Feature(247)
            };
            var bounty = new FeatureProduct("Bounty", bountyFeatures);
            List <FeatureProduct> testList = new List <FeatureProduct> {
                snickers, bounty
            };

            Assert.Empty(ListFiltering.AllFeaturesProducts(testList, new List <Feature> {
                new Feature(251), new Feature(240)
            }));
        }
Пример #2
0
        public void OneFeatureProductsFindsProductsWithContainingFeature()
        {
            var snickersFeatures = new List <Feature> {
                new Feature(251), new Feature(247)
            };
            var snickers       = new FeatureProduct("Snickers", snickersFeatures);
            var bountyFeatures = new List <Feature> {
                new Feature(240), new Feature(247)
            };
            var bounty = new FeatureProduct("Bounty", bountyFeatures);
            List <FeatureProduct> testList = new List <FeatureProduct> {
                snickers, bounty
            };

            Assert.Equal(new List <FeatureProduct> {
                snickers
            }, ListFiltering.OneFeatureProducts(testList, new List <Feature> {
                new Feature(251)
            }));
        }
Пример #3
0
        public void AllFeatruesProductsFindsProductsWithAllFeatures()
        {
            Feature        firstFeature  = new Feature(2);
            Feature        secondFeature = new Feature(3);
            FeatureProduct apples        = new FeatureProduct("appels", new List <Feature> {
                firstFeature, secondFeature
            });
            FeatureProduct pears = new FeatureProduct("pears", new List <Feature> {
                secondFeature
            });
            var productList = new List <FeatureProduct> {
                apples, pears
            };
            var filteringCriteria = new List <Feature> {
                firstFeature, secondFeature
            };
            var filtered = ListFiltering.AllFeaturesProducts(productList, filteringCriteria);

            Assert.Equal(new List <FeatureProduct> {
                apples
            }, filtered);
        }