コード例 #1
0
        public void TestGetDrilldownGraphWithOneFilter()
        {
            // Arrange
            Reset();
            SetupConnection();
            var tree       = BusinessLayerTestHelper.CreateDimensionTree(DatasetName);
            var xDimension = tree.GetDimensionDto(4); // xDimension = category
            var measure    = new Measure {
                Name = "Units"
            };
            // Show only bakery
            var filters = BusinessLayerTestHelper.GetBakeryFilter(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(1);
            graph.Roots[0].Name.ShouldBeEquivalentTo("Bakery");
            graph.Roots[0].XAxisLeaves.Count.ShouldBeEquivalentTo(2);
            var breadLeaf = (DrilldownGraphXAxisLeafDto)graph.Roots[0].XAxisLeaves[0];
            var bunLeaf   = (DrilldownGraphXAxisLeafDto)graph.Roots[0].XAxisLeaves[1];

            breadLeaf.Name.ShouldBeEquivalentTo("Bread");
            breadLeaf.Value.ShouldBeEquivalentTo(80);
            bunLeaf.Name.ShouldBeEquivalentTo("Bun");
            bunLeaf.Value.ShouldBeEquivalentTo(150);
        }