示例#1
0
        public void CreateQuery_WithMultipleCubesAndRangeWhereClause_QueryCreatedAsExpected()
        {
            const string expectedQueryString = "SELECT " +
                                               "NON EMPTY { [Dim Hierarchy].[Dim] } ON Columns " +
                                               "FROM [Cube1], [Cube2], [Cube3] " +
                                               "WHERE { ( { ( [Dim Hierarchy].[Dim].[Dim Key].&[1]:[Dim Hierarchy].[Dim].[Dim Key].&[4] ) } ) }";

            var query = Mdx.Query()
                        .On(Mdx.Axis(0).AsNonEmpty().WithSlicer(Mdx.Tuple().With(Mdx.Member("Dim Hierarchy", "Dim"))))
                        .From(Mdx.Cube("Cube1"))
                        .From(Mdx.Cube("Cube2"))
                        .From(Mdx.Cube("Cube3"))
                        .Where(Mdx.Tuple().With(Mdx.Set().With(
                                                    Mdx.Range()
                                                    .From(Mdx.Member("Dim Hierarchy", "Dim", "Dim Key").WithValue("1"))
                                                    .To(Mdx.Member("Dim Hierarchy", "Dim", "Dim Key").WithValue("4")))));

            query.ToString().Should().Be(expectedQueryString);
        }