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); }
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); }
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)); }
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)); }