Example #1
0
        public void TopQueryTest()
        {
            Setup();
            CleanUp();
            Setup();

            Expect.IsTrue(_testDatabases.Count > 0);
            string startsWith = 8.RandomLetters();
            string methodName = MethodBase.GetCurrentMethod().Name;

            _testDatabases.Each(db =>
            {
                OutLineFormat("{0}.{1}: {2}", ConsoleColor.DarkYellow, this.GetType().Name, methodName, db.GetType().Name);
                8.Times(i =>
                {
                    DataTools.CreateTestTable("{0}_{1}"._Format(startsWith, 6.RandomLetters()), db);
                });

                3.Times(i =>
                {
                    DataTools.CreateTestTable(5.RandomLetters(), db);
                });

                TestTableCollection top4 = TestTable.Top(4, c => c.Name.StartsWith(startsWith), db);
                Expect.AreEqual(4, top4.Count);
            });
        }