コード例 #1
0
        public void Test()
        {
            var dataBuilder = new SampleDataBuilder(10);

            var shirts = new List <Shirt>
            {
                new Shirt(Guid.NewGuid(), "Red - Small", Size.Small, Color.Red),
                new Shirt(Guid.NewGuid(), "Black - Medium", Size.Medium, Color.Black),
                new Shirt(Guid.NewGuid(), "Blue - Large", Size.Large, Color.Blue),
            };


            var colors = dataBuilder.GetAllColors();
            var sizes  = dataBuilder.GetAllSizes();


            var searchEngine = new SearchEngine(shirts, sizes, colors);

            var searchOptions = new SearchOptions
            {
                Colors = new List <Color> {
                    Color.Red
                }
            };

            var results = searchEngine.Search(searchOptions);

            AssertResults(results.Shirts, searchOptions);
            AssertSizeCounts(shirts, searchOptions, results.SizeCounts);
            AssertColorCounts(shirts, searchOptions, results.ColorCounts);
        }
コード例 #2
0
        public void Setup()
        {
            var dataBuilder = new SampleDataBuilder(50000);

            _shirts = dataBuilder.CreateShirts();
            _colors = dataBuilder.GetAllColors();
            _sizes  = dataBuilder.GetAllSizes();

            _searchEngine = new SearchEngine(_shirts, _sizes, _colors);
        }