Esempio n. 1
0
        private void GenerateAndOpenReport(CreationType createType)
        {
            var data   = SampleDataBuilder.Build();
            var result = this._createReportCommand.Execute(data, createType);

            TryWriteAndOpen(result, createType.ToString());
        }
        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);
        }
Esempio n. 3
0
        private void GenerateStackedBarChartReport_OnClick(object sender, RoutedEventArgs e)
        {
            var data   = SampleDataBuilder.BuildStackedBarChartData();
            var result = _createExportMetadataBasedReportCommand.Execute(data, "StackedBarChartDataPart", "StackedBarChart");

            TryWriteAndOpen(result, "StackedBarChart");
        }
        public void PerformanceTest_1000000_RandomShirts()
        {
            var dataBuilder = new SampleDataBuilder(1000000);

            _shirts = dataBuilder.CreateShirts();

            _searchEngine = new SearchEngine(_shirts);

            var sw = new Stopwatch();

            sw.Start();

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

            var results = _searchEngine.Search(options);

            sw.Stop();
            Console.WriteLine($"Test fixture finished in {sw.ElapsedMilliseconds} milliseconds");

            AssertResults(results.Shirts, options);
            AssertSizeCounts(results.Shirts, options, results.SizeCounts);
            AssertColorCounts(results.Shirts, options, results.ColorCounts);
        }
Esempio n. 5
0
        public void Setup()
        {
            var dataBuilder = new SampleDataBuilder(50000);

            _shirts       = dataBuilder.CreateShirts();
            _searchEngine = new SearchEngine(_shirts);
        }
Esempio n. 6
0
        private static List <Shirt> Given_NumberShirts(int numberOfShirts)
        {
            var dataBuilder = new SampleDataBuilder(numberOfShirts);

            var shirts = dataBuilder.CreateShirts();

            return(shirts);
        }
        public void Setup()
        {
            var dataBuilder = new SampleDataBuilder(50000);

            _shirts = dataBuilder.CreateShirts();

            _searchEngine = new SearchEngine(_shirts, new ShirtIndexer(), new IndexHelper(), new SearchResultMapper());
        }
        public void Setup()
        {
            _mockValidateService = new Mock <IValidationService>();
            var dataBuilder = new SampleDataBuilder(5000000);

            _shirts = dataBuilder.CreateShirts();

            _searchEngine = new SearchEngine(_shirts, _mockValidateService.Object);
        }
        public void Setup()
        {
            var dataBuilder = new SampleDataBuilder(50000);

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

            _searchEngine = new SearchEngine(_shirts, _sizes, _colors);
        }
        public void SearchThrough5000000ShirtsWithAllCombinations_ShouldTakeLessThan100ms()
        {
            var sw      = new Stopwatch();
            var options = new SearchOptions
            {
                Colors = Color.All,
                Sizes  = Size.All
            };

            var dataBuilder = new SampleDataBuilder(5000000);

            _shirts       = dataBuilder.CreateShirts();
            _searchEngine = new SearchEngine(_shirts);

            sw.Start();
            var results = _searchEngine.Search(options);

            sw.Stop();

            Console.WriteLine($"Test fixture finished in {sw.ElapsedMilliseconds} milliseconds");

            //This takes 35ms in my machine as an attempt to push the performance of the Search Engine. Could take longer in different machines.
            //sw.ElapsedMilliseconds.Should().BeLessThan(100, "This Performance test should run under 100 ms");
        }
        private List <Shirt> GetShirts(int count = 10)
        {
            var dataBuilder = new SampleDataBuilder(count);

            return(dataBuilder.CreateShirts());
        }
Esempio n. 12
0
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            var sampleMovies = new SampleDataBuilder().GetSampleData();

            sampleMovies.ForEach(movie => modelBuilder.Entity <Movie>().HasData(movie));
        }