コード例 #1
0
        public void TestSkylineAmountOfTupelsDataTable()
        {
            string skylineSampleSql = TestContext.DataRow["skylineSQL"].ToString();

            SQLCommon common = new SQLCommon();

            common.SkylineType = new SkylineSQL();
            PrefSQLModel model    = common.GetPrefSqlModelFromPreferenceSql(skylineSampleSql);
            DataTable    dtNative = common.ExecuteFromPrefSqlModel(Helper.ConnectionString, Helper.ProviderName, model);

            common.SkylineType = new SkylineBNL();
            DataTable dtBNL = common.ParseAndExecutePrefSQL(Helper.ConnectionString, Helper.ProviderName, skylineSampleSql);

            common.SkylineType = new SkylineBNLSort();
            DataTable dtBNLSort = common.ParseAndExecutePrefSQL(Helper.ConnectionString, Helper.ProviderName, skylineSampleSql);

            DataTable dtHexagon = new DataTable();

            if (model.ContainsOpenPreference == false)
            {
                common.SkylineType = new SkylineHexagon();
                dtHexagon          = common.ParseAndExecutePrefSQL(Helper.ConnectionString, Helper.ProviderName, skylineSampleSql);
            }

            DataTable dtDQ = new DataTable();

            //D&Q does not work with incomparable tuples
            if (model.WithIncomparable == false)
            {
                common.SkylineType = new SkylineDQ();
                dtDQ = common.ParseAndExecutePrefSQL(Helper.ConnectionString, Helper.ProviderName, skylineSampleSql);
            }

            int currentDataRowIndex = TestContext.DataRow.Table.Rows.IndexOf(TestContext.DataRow);

            //Check tuples (every algorithm should deliver the same amount of tuples)
            Assert.AreEqual(dtNative.Rows.Count, dtBNL.Rows.Count, 0,
                            "BNL Amount of tupels in query " + currentDataRowIndex + " do not match");
            Assert.AreEqual(dtNative.Rows.Count, dtBNLSort.Rows.Count, 0,
                            "BNLSort Amount of tupels in query " + currentDataRowIndex + " do not match");

            //Hexagon cannot handle Categorical preference that have no explicit OTHERS
            if (model.ContainsOpenPreference == false)
            {
                Assert.AreEqual(dtNative.Rows.Count, dtHexagon.Rows.Count, 0,
                                "Hexagon Amount of tupels in query " + currentDataRowIndex + " do not match");
            }
            //D&Q does not work with incomparable tuples
            if (model.WithIncomparable == false)
            {
                Assert.AreEqual(dtNative.Rows.Count, dtDQ.Rows.Count, 0,
                                "D&Q Amount of tupels in query " + currentDataRowIndex + " do not match");
            }
        }