Пример #1
0
        public void TestShowChartDefinedManually()
        {
            // Arrange
            Reset();
            var filters = BusinessLayerTestHelper.GetBreadMilkEuropeFiltersAsFilterViewModel();
            var tree    = BusinessLayerTestHelper.CreateDimensionTree("TestDataset");

            SetupDataLayer(tree);
            // Act
            _testee.ShowChart(1, 1, 1, 2, true, filters);
            // Assert
            _dataMock.Verify(dm => dm.GetDataset(1));
            _dataMock.Verify(dm => dm.GetMeasure(1));
            // Filter predicates
            Predicate <List <FlatDimensionDto> > hasTwoMembers       = l => l.Count == 2;
            Predicate <FlatDimensionDto>         breadMilkFilterIsOk =
                bmf => (bmf.Id == 3 && bmf.DimensionValues.Count == 2 &&
                        bmf.DimensionValues[0].Id == 1 && bmf.DimensionValues[1].Id == 3);
            Predicate <FlatDimensionDto> europeFilterIsOk =
                ef => (ef.Id == 2 && ef.DimensionValues.Count == 1 && ef.DimensionValues[0].Id == 1);

            _graphServiceMock.Verify(gs => gs.GetGroupedGraph(tree,
                                                              It.Is <TreeDimensionDto>(td => td.Id == 1), It.Is <TreeDimensionDto>(d => d.Id == 2),
                                                              It.Is <Measure>(m => m.Id == 1),
                                                              It.Is <List <FlatDimensionDto> >(f => hasTwoMembers(f) && breadMilkFilterIsOk(f[0]) && europeFilterIsOk(f[1])), It.Is <bool>(b => b)));

            _graphServiceMock.Verify(gs => gs.GetDrilldownGraph(tree,
                                                                It.Is <TreeDimensionDto>(td => td.Id == 1),
                                                                It.Is <Measure>(m => m.Id == 1),
                                                                It.Is <List <FlatDimensionDto> >(f => hasTwoMembers(f) && breadMilkFilterIsOk(f[0]) && europeFilterIsOk(f[1])), It.Is <bool>(b => b == false)));

            _browseCubeMock.Verify(bcm => bcm.Map(It.IsAny <GroupedGraphDto>()));
            _browseCubeMock.Verify(bcm => bcm.Map(It.IsAny <DrilldownGraphDto>()));
        }