public void RunTests()
        {
            Setup();

            var stopwatch = Stopwatch.StartNew();
            var sqltester = new CommandsQueriesTests(Dialect.SQLServer);

            foreach (var method in typeof(CommandsQueriesTests).GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly))
            {
                var testwatch = Stopwatch.StartNew();
                Console.Write("Running " + method.Name + " in sql server");
                method.Invoke(sqltester, null);
                testwatch.Stop();
                Console.WriteLine(" - OK! {0}ms", testwatch.ElapsedMilliseconds);
            }
            stopwatch.Stop();
            Console.Write("\n\nSQL Server testing complete.");
            // Write result
            Console.WriteLine("\nTime elapsed: {0}", stopwatch.Elapsed);

            using (var connection = new SqlConnection(Settings.SqlServer("master")))
            {
                connection.Open();
                try
                {
                    //drop any remaining connections, then drop the db.
                    connection.Execute(@" alter database DapperSimpleCrudTestDb set single_user with rollback immediate; DROP DATABASE DapperSimpleCrudTestDb; ");
                }
                catch (Exception)
                { }
            }

            //Console.ReadKey();
        }
        public void RunTests()
        {
            Setup();

            var stopwatch   = Stopwatch.StartNew();
            var mysqltester = new CommandsQueriesTests(Dialect.MySQL);

            foreach (var method in typeof(CommandsQueriesTests).GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly))
            {
                //skip schema tests
                if (method.Name.Contains("Schema"))
                {
                    continue;
                }
                if (method.Name.Contains("Guid"))
                {
                    continue;
                }

                var testwatch = Stopwatch.StartNew();
                Console.Write("Running " + method.Name + " in MySQL");
                method.Invoke(mysqltester, null);
                Console.WriteLine(" - OK! {0}ms", testwatch.ElapsedMilliseconds);
            }
            stopwatch.Stop();
            Console.Write("\n\nMySQL testing complete.");
            Console.WriteLine("\nTime elapsed: {0}", stopwatch.Elapsed);

            //Console.ReadKey();
        }
Example #3
0
        public void RunTests()
        {
            Setup();

            var stopwatch = Stopwatch.StartNew();
            var pgtester  = new CommandsQueriesTests(Dialect.PostgreSQL);

            foreach (var method in typeof(CommandsQueriesTests).GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly))
            {
                var testwatch = Stopwatch.StartNew();
                Console.Write("Running " + method.Name + " in PostgreSQL");
                method.Invoke(pgtester, null);
                Console.WriteLine(" - OK! {0}ms", testwatch.ElapsedMilliseconds);
            }

            stopwatch.Stop();
            Console.Write("PostgreSQL testing complete.");
            Console.WriteLine("Time elapsed: {0}", stopwatch.Elapsed);

            //Console.ReadKey();
        }