示例#1
0
        public void TestGetDrilldownGraphWithTwoFilters()
        {
            // Arrange
            Reset();
            SetupConnection();
            var tree       = BusinessLayerTestHelper.CreateDimensionTree(DatasetName);
            var xDimension = tree.GetDimensionDto(4); // xDimension = category
            var measure    = new Measure {
                Name = "Units"
            };
            // Show only bakery
            // Show only bread and milk in Europe
            var filters = BusinessLayerTestHelper.GetBreadMilkEuropeFilter(tree);
            // Act
            var graph = _graphService.GetDrilldownGraph(tree, xDimension, measure, filters, true);

            // Assert
            graph.Name.Should().Contain(xDimension.Name);
            graph.Name.Should().Contain(measure.Name);
            graph.Roots.Count.ShouldBeEquivalentTo(2);
            graph.Roots[0].Name.ShouldBeEquivalentTo("Bakery");
            graph.Roots[1].Name.ShouldBeEquivalentTo("Dairy");
            graph.Roots[0].XAxisLeaves.Count.ShouldBeEquivalentTo(1);
            var breadLeaf = (DrilldownGraphXAxisLeafDto)graph.Roots[0].XAxisLeaves[0];
            var milkLeaf  = (DrilldownGraphXAxisLeafDto)graph.Roots[1].XAxisLeaves[0];

            breadLeaf.Name.ShouldBeEquivalentTo("Bread");
            breadLeaf.Value.ShouldBeEquivalentTo(30);
            milkLeaf.Name.ShouldBeEquivalentTo("Milk");
            milkLeaf.Value.ShouldBeEquivalentTo(15);
        }
示例#2
0
        public void TestGetGroupedGraphWithTwoFiltersWithoutGrouping()
        {
            // Arrange
            Reset();
            SetupConnection();
            var tree            = BusinessLayerTestHelper.CreateDimensionTree(DatasetName);
            var xDimension      = tree.GetDimensionDto(4); // xDimension = category
            var legendDimension = tree.GetDimensionDto(1); // legendDimension = place
            var measure         = new Measure {
                Name = "Units"
            };
            // Show only bakery
            // Show only bread and milk in Europe
            var filters = BusinessLayerTestHelper.GetBreadMilkEuropeFilter(tree);
            // Act
            var graph        = _graphService.GetGroupedGraph(tree, xDimension, legendDimension, measure, filters, false);
            var legendValues = graph.GetLegendValues().ToList();

            // Assert
            graph.Name.Should().Contain(xDimension.Name);
            graph.Name.Should().Contain(legendDimension.Name);
            graph.Name.Should().Contain(measure.Name);

            graph.Roots.Count.ShouldBeEquivalentTo(1);
            graph.Roots[0].XAxisLeaves.Count.ShouldBeEquivalentTo(2);
            graph.Roots[0].XAxisLeaves[0].Name.ShouldBeEquivalentTo("Bakery");
            graph.Roots[0].XAxisLeaves[1].Name.ShouldBeEquivalentTo("Dairy");
            legendValues.Count.ShouldBeEquivalentTo(4);
            // Bread
            legendValues[0].Value.ShouldBeEquivalentTo(20);
            legendValues[1].Value.ShouldBeEquivalentTo(10);
            // Milk
            legendValues[2].Value.ShouldBeEquivalentTo(10);
            legendValues[3].Value.ShouldBeEquivalentTo(5);
        }