Exemplo n.º 1
0
        private static void RunTestMySql()
        {
            var stopwatch   = Stopwatch.StartNew();
            var mysqltester = new SimpleCrudTest(SimpleCRUD.Dialect.MySQL);

            foreach (var method in typeof(SimpleCrudTest).GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly))
            {
                //skip schema tests
                if (method.Name.Contains("Schema"))
                {
                    continue;
                }
                if (method.Name.Contains("Guid"))
                {
                    continue;
                }
                if (method.Name.Contains("KeyMaster"))
                {
                    continue;
                }
                if (method.Name.Contains("Ignore"))
                {
                    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.WriteLine("Time elapsed: {0}", stopwatch.Elapsed);

            Console.Write("MySQL testing complete.");
        }
Exemplo n.º 2
0
        /// <summary>
        /// test sql server
        /// </summary>
        private static void RunTestSqlServer()
        {
            var stopwatch = Stopwatch.StartNew();
            var sqltester = new SimpleCrudTest(SimpleCRUD.Dialect.SQLServer);

            foreach (var method in typeof(SimpleCrudTest).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($" -√ {testwatch.ElapsedMilliseconds}'ms ");
            }
            stopwatch.Stop();
            //write result
            Console.WriteLine($"Time elapsed :{stopwatch.Elapsed}");

            using (var connection = SqlConnectionHelper.GetOpenConnection(@"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=Master;Integrated Security=True"))
            {
                try
                {
                    connection.Execute(@" alter database DapperSimpleCrudTestDb set single_user with rollback immediate; DROP DATABASE DapperSimpleCrudTestDb; ");
                }
                catch (Exception)
                {
                }
            }
            Console.Write("SQL Server testing complete.");
        }
Exemplo n.º 3
0
        /// <summary>
        /// test pg server
        /// </summary>
        private static void RunTestPg()
        {
            var stopwatch = Stopwatch.StartNew();
            var pgtester  = new SimpleCrudTest(SimpleCRUD.Dialect.PostgreSQL);

            foreach (var method in typeof(SimpleCrudTest).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.WriteLine("Time elapsed: {0}", stopwatch.Elapsed);

            Console.Write("PostgreSQL testing complete.");
            Console.ReadKey();
        }
Exemplo n.º 4
0
        /// <summary>
        /// test sqlite
        /// </summary>
        private void RunTestsSqLite()
        {
            var stopwatch = Stopwatch.StartNew();
            var pgtester  = new SimpleCrudTest(SimpleCRUD.Dialect.SQLite);

            foreach (var method in typeof(SimpleCrudTest).GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly))
            {
                //skip schema tests
                if (method.Name.Contains("Schema"))
                {
                    continue;
                }
                var testwatch = Stopwatch.StartNew();
                Console.Write("Running\t" + method.Name + "\tin SQLite");
                method.Invoke(pgtester, null);
                Console.WriteLine("\t- OK! \t{0}ms", testwatch.ElapsedMilliseconds);
            }
            stopwatch.Stop();
            Console.WriteLine("Time elapsed: {0}", stopwatch.Elapsed);
            Console.Write("SQLite testing complete.");
            Console.ReadKey();
        }