コード例 #1
0
        public void SalesByTypePerMonthTotalValue()
        {
            var subject = new SaleTotalValueGrouping(
                new GroupByMonth <Sale>(
                    new GroupByType <Sale>(
                        new MockedDataSource()
                        )
                    )
                );

            Chart chart = subject.Chart();

            chart.PointCategories.Count().Should().Be(2);

            foreach (ChartLine chartLine in chart.ChartLines)
            {
                chartLine.Data.Length.Should().Be(2);
            }

            chart.PointCategories.First().Should().Be("2018-2");
            chart.PointCategories.Last().Should().Be("2018-3");

            chart.ChartLines.ElementAt(0).Data.Should().BeEquivalentTo(new[] { 0, 5309 });
            chart.ChartLines.ElementAt(1).Data.Should().BeEquivalentTo(new[] { 0, 2687 });
            chart.ChartLines.ElementAt(2).Data.Should().BeEquivalentTo(new[] { 0, 11729 });
            chart.ChartLines.ElementAt(3).Data.Should().BeEquivalentTo(new[] { 37893, 0 });
        }
コード例 #2
0
        public void SalesByTypePerWeekTotalValue()
        {
            var subject = new SaleTotalValueGrouping(
                new GroupByWeek <Sale>(
                    new GroupByType <Sale>(
                        new MockedDataSource()
                        )
                    )
                );

            Chart chart = subject.Chart();

            chart.PointCategories.Count().Should().Be(9);

            foreach (ChartLine chartLine in chart.ChartLines)
            {
                chartLine.Data.Length.Should().Be(9);
            }

            chart.PointCategories.First().Should().Be("2018-5");
            chart.PointCategories.Last().Should().Be("2018-13");

            chart.ChartLines.ElementAt(0).Data.Should().BeEquivalentTo(new[] { 0, 0, 0, 0, 0, 0, 0, 2655, 2655 });
            chart.ChartLines.ElementAt(1).Data.Should().BeEquivalentTo(new[] { 0, 0, 0, 0, 0, 0, 2687, 0, 0 });
            chart.ChartLines.ElementAt(2).Data.Should().BeEquivalentTo(new[] { 11729, 0, 0, 0, 0, 0, 0, 0, 0 });
            chart.ChartLines.ElementAt(3).Data.Should().BeEquivalentTo(new[] { 15157, 3789, 11368, 7579, 0, 0, 0, 0, 0 });
        }
コード例 #3
0
        public void SaleTotalValueGrouping()
        {
            var subject = new SaleTotalValueGrouping(
                new MockedPointGrouping()
                );

            var chart = subject.Chart();

            chart.PointCategories.Count().Should().Be(1);
            chart.ChartLines.Count().Should().Be(1);
            chart.ChartLines.ElementAt(0).Data.ElementAt(0).Should().Be(9000);
        }
コード例 #4
0
        public void LoadTest()
        {
            var subject = new SaleTotalValueGrouping(
                new GroupByWeek <Sale>(
                    new GroupByType <Sale>(
                        new SaleDataSource()
                        )
                    )
                );

            var stopwatch = Stopwatch.StartNew();

            subject.Chart();
            stopwatch.Stop();

            stopwatch.ElapsedMilliseconds.Should().BeLessOrEqualTo(200);
        }