コード例 #1
0
ファイル: QueryAdomdEngineTest.cs プロジェクト: zyh329/nbi
        public void Execute_ValidMdx_GetResult()
        {
            var query = "SELECT  [Measures].[Amount] ON 0, [Date].[Calendar].[Calendar Year] ON 1 FROM [Adventure Works]";
            var cmd   = new AdomdCommand(query, new AdomdConnection(ConnectionStringReader.GetAdomd()));

            var qe = new QueryAdomdEngine(cmd);
            var ds = qe.Execute();

            Assert.IsInstanceOf <string>(ds.Tables[0].Rows[0][0]);
            Assert.AreEqual((string)ds.Tables[0].Rows[0][0], "CY 2005");
            Assert.AreEqual((string)ds.Tables[0].Rows[1][0], "CY 2006");
            Assert.IsInstanceOf <double>(ds.Tables[0].Rows[1][1]);
        }
コード例 #2
0
ファイル: QueryAdomdEngineTest.cs プロジェクト: zyh329/nbi
        public void Execute_ValidMdxWithNull_GetResult()
        {
            var query = "SELECT  [Measures].[Amount] ON 0, [Date].[Calendar].[Calendar Year].&[2010] ON 1 FROM [Adventure Works]";
            var cmd   = new AdomdCommand(query, new AdomdConnection(ConnectionStringReader.GetAdomd()));

            var qe = new QueryAdomdEngine(cmd);
            var ds = qe.Execute();

            Assert.IsInstanceOf <string>(ds.Tables[0].Rows[0][0]);
            Assert.AreEqual((string)ds.Tables[0].Rows[0][0], "CY 2010");

            Assert.IsInstanceOf <System.DBNull>(ds.Tables[0].Rows[0][1]);
            Assert.That(ds.Tables[0].Rows[0].IsNull(1), Is.True);
        }
コード例 #3
0
ファイル: QueryAdomdEngineTest.cs プロジェクト: zyh329/nbi
        public void Execute_ValidDax_GetResult()
        {
            var query = "EVALUATE CALCULATETABLE(VALUES('Product Subcategory'[Product Subcategory Name]),'Product Category'[Product Category Name] = \"Bikes\")";

            var cmd = new AdomdCommand(query, new AdomdConnection(ConnectionStringReader.GetAdomdTabular()));

            var qe = new QueryAdomdEngine(cmd);
            var ds = qe.Execute();

            Assert.IsInstanceOf <string>(ds.Tables[0].Rows[0][0]);
            Assert.AreEqual((string)ds.Tables[0].Rows[0][0], "Mountain Bikes");
            Assert.AreEqual((string)ds.Tables[0].Rows[1][0], "Road Bikes");
            Assert.AreEqual((string)ds.Tables[0].Rows[2][0], "Touring Bikes");

            Assert.AreEqual(ds.Tables[0].Rows.Count, 3);
            Assert.AreEqual(ds.Tables[0].Columns.Count, 1);
        }