private static void RunTestsPg() { var stopwatch = Stopwatch.StartNew(); var pgtester = new Tests(SimpleCRUD.Dialect.PostgreSQL); foreach (var method in typeof(Tests).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(); }
private static void RunTestsMySQL() { var stopwatch = Stopwatch.StartNew(); var mysqltester = new Tests(SimpleCRUD.Dialect.MySQL); foreach (var method in typeof(Tests).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.WriteLine("Time elapsed: {0}", stopwatch.Elapsed); Console.Write("MySQL testing complete."); Console.ReadKey(); }
private static void RunTests() { var stopwatch = Stopwatch.StartNew(); var sqltester = new Tests(SimpleCRUD.Dialect.SQLServer); foreach (var method in typeof(Tests).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(); // Write result Console.WriteLine("Time elapsed: {0}", stopwatch.Elapsed); using (var connection = new SqlConnection(@"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=Master;Integrated Security=True")) { 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.Write("SQL Server testing complete."); Console.ReadKey(); }