@@ -60,30 +60,47 @@ protected void CreateNewDatabase()
60
60
ConnectionString = GetFileConnectionString ( ) ;
61
61
}
62
62
63
+ enum DbType
64
+ {
65
+ Sqlite ,
66
+ SqlServer ,
67
+ PostgreSql ,
68
+ MySql ,
69
+ SqlServerMdf ,
70
+ }
71
+
63
72
[ TestFixtureSetUp ]
64
73
public void TestFixtureSetUp ( )
65
74
{
66
75
LogManager . LogFactory = new ConsoleLogFactory ( ) ;
67
76
68
- //OrmLiteConfig.DialectProvider = MySqlDialect.Provider;
69
- //ConnectionString = "Server=localhost;Database=test;UID=root;Password=test";
70
- //return;
71
-
72
- var useSqlite = true ;
73
- if ( useSqlite )
74
- {
75
- OrmLiteConfig . DialectProvider = SqliteDialect . Provider ;
76
- ConnectionString = GetFileConnectionString ( ) ;
77
- ConnectionString = ":memory:" ;
78
- }
79
- else
80
- {
81
- OrmLiteConfig . DialectProvider = SqlServerDialect . Provider ;
82
- ConnectionString = Config . SqlServerBuildDb ;
77
+ //var dbType = DbType.Sqlite;
78
+ var dbType = DbType . SqlServer ;
79
+
80
+ switch ( dbType )
81
+ {
82
+ case DbType . Sqlite :
83
+ OrmLiteConfig . DialectProvider = SqliteDialect . Provider ;
84
+ ConnectionString = GetFileConnectionString ( ) ;
85
+ ConnectionString = ":memory:" ;
86
+ return ;
87
+ case DbType . SqlServer :
88
+ OrmLiteConfig . DialectProvider = SqlServerDialect . Provider ;
89
+ ConnectionString = Config . SqlServerBuildDb ;
90
+ return ;
91
+ case DbType . MySql :
92
+ OrmLiteConfig . DialectProvider = MySqlDialect . Provider ;
93
+ ConnectionString = "Server=localhost;Database=test;UID=root;Password=test" ;
94
+ return ;
95
+ case DbType . PostgreSql :
96
+ OrmLiteConfig . DialectProvider = PostgreSqlDialect . Provider ;
97
+ ConnectionString = Environment . GetEnvironmentVariable ( "PGSQL_TEST" ) ;
98
+ return ;
99
+ case DbType . SqlServerMdf :
100
+ ConnectionString = "~/App_Data/Database1.mdf" . MapAbsolutePath ( ) ;
101
+ ConnectionString = Config . GetDefaultConnection ( ) ;
102
+ return ;
83
103
}
84
-
85
- //ConnectionString = "~/App_Data/Database1.mdf".MapAbsolutePath();
86
- //ConnectionString = Config.GetDefaultConnection();
87
104
}
88
105
89
106
public void Log ( string text )
0 commit comments