示例#1
0
        public void AppendQuery_OneWhere_ExtendedWhereClause()
        {
            const string initialQueryString = "SELECT { [MyMember] } ON Columns " +
                                              "FROM [Cube] " +
                                              "WHERE { ( { ( [Test].[Test Name].&[test] ) }) }";

            const string expectedQueryString = "SELECT { [MyMember] } ON Columns " +
                                               "FROM [Cube] " +
                                               "WHERE { ( { ( { ( [Test].[Test Name].&[test] ) } ) }, { [Company].[Company Name].&[test] } ) }";

            var mdxQuery = new MdxParser().ParseQuery(initialQueryString);

            mdxQuery.Where(Mdx.Tuple().With(Mdx.Member("Company", "Company Name").WithValue("test")));

            mdxQuery.ToString().Should().Be(expectedQueryString);
        }
示例#2
0
        public void ChangeQuery_OneAxisSlicer_RemoveSetMember()
        {
            const string initialQueryString = "SELECT { [MyMember], [MemberToRemove] } ON Columns " +
                                              "FROM [Cube]";

            const string expectedQueryString = "SELECT { [MyMember] } ON Columns " +
                                               "FROM [Cube]";

            var mdxQuery = new MdxParser().ParseQuery(initialQueryString);

            var tuple          = mdxQuery.Axes.Select(a => a.AxisSlicer).FirstOrDefault();
            var memberToRemove = tuple.GetMember("MemberToRemove");

            tuple.Without(memberToRemove);

            mdxQuery.ToString().Should().Be(expectedQueryString);
        }
示例#3
0
        public void AppendQuery_OneWhere_ExtendedWhereClause()
        {
            //ARRANGE
            const string initialQueryString = "SELECT { [MyMember] } ON Columns " +
                                   "FROM [Cube] " +
                                   "WHERE { ( { ( [Test].[Test Name].&[test] ) }) }";

            const string expectedQueryString = "SELECT { [MyMember] } ON Columns " +
                                               "FROM [Cube] " +
                                               "WHERE { ( { ( { ( [Test].[Test Name].&[test] ) } ) }, { [Company].[Company Name].&[test] } ) }";

            //ACT
            var mdxQuery = new MdxParser().ParseQuery(initialQueryString);
            mdxQuery.Where(Mdx.Tuple().With(Mdx.Member("Company", "Company Name").WithValue("test")));

            //ASSERT
            Assert.That(mdxQuery.ToString(), Is.EqualTo(expectedQueryString));
        }
示例#4
0
        public void AppendQuery_OneWhere_ExtendedWhereClause()
        {
            //ARRANGE
            const string initialQueryString = "SELECT { [MyMember] } ON Columns " +
                                              "FROM [Cube] " +
                                              "WHERE { ( { ( [Test].[Test Name].&[test] ) }) }";


            const string expectedQueryString = "SELECT { [MyMember] } ON Columns " +
                                               "FROM [Cube] " +
                                               "WHERE { ( { ( { ( [Test].[Test Name].&[test] ) } ) }, { [Company].[Company Name].&[test] } ) }";

            //ACT
            var mdxQuery = new MdxParser().ParseQuery(initialQueryString);

            mdxQuery.Where(Mdx.Tuple().With(Mdx.Member("Company", "Company Name").WithValue("test")));

            //ASSERT
            Assert.That(mdxQuery.ToString(), Is.EqualTo(expectedQueryString));
        }
示例#5
0
        public void ChangeQuery_OneAxisSlicer_RemoveSetMember()
        {
            //ARRANGE
            const string initialQueryString = "SELECT { [MyMember], [MemberToRemove] } ON Columns " +
                                   "FROM [Cube]";

            const string expectedQueryString = "SELECT { [MyMember] } ON Columns " +
                                   "FROM [Cube]";

            //ACT
            var mdxQuery = new MdxParser().ParseQuery(initialQueryString);

            var tuple = mdxQuery.Axes.Select(a => a.AxisSlicer).FirstOrDefault();
            if (tuple != null)
            {
                var memberToRemove = tuple.GetMember("MemberToRemove");
                tuple.Without(memberToRemove);
            }

            //ASSERT
            Assert.That(mdxQuery.ToString(), Is.EqualTo(expectedQueryString));
        }
示例#6
0
        public void ChangeQuery_OneAxisSlicer_RemoveSetMember()
        {
            //ARRANGE
            const string initialQueryString = "SELECT { [MyMember], [MemberToRemove] } ON Columns " +
                                              "FROM [Cube]";


            const string expectedQueryString = "SELECT { [MyMember] } ON Columns " +
                                               "FROM [Cube]";

            //ACT
            var mdxQuery = new MdxParser().ParseQuery(initialQueryString);

            var tuple = mdxQuery.Axes.Select(a => a.AxisSlicer).FirstOrDefault();

            if (tuple != null)
            {
                var memberToRemove = tuple.GetMember("MemberToRemove");
                tuple.Without(memberToRemove);
            }

            //ASSERT
            Assert.That(mdxQuery.ToString(), Is.EqualTo(expectedQueryString));
        }