Пример #1
0
		public static void Initialize()
		{
			var testDBType = Convert.ToInt32(ConfigurationManager.AppSettings["TestDBType"]);
			switch (testDBType)
			{
				case 1: // SQLite In-Memory
					throw new NotSupportedException("SQLite not supported DB type.");
					//return;

				case 2: // SQL Local DB
					_dbDirect = new SqlLocalDatabase(ConfigurationManager.ConnectionStrings["ConStr_Primary"].ConnectionString);
					_db = new Database(_dbDirect.Connection, new NPoco.DatabaseTypes.SqlServer2008DatabaseType(), IsolationLevel.ReadUncommitted); // Need read uncommitted for the transaction tests
					break;

				case 3: // SQL Server
				case 4: // SQL CE
				case 5: // MySQL
				case 6: // Oracle
				case 7: // Postgres

				default:
					throw new NotSupportedException("Unknown database platform specified.");
					//return;
			}

			// Insert test data
			TestData.RecreateData(_db);
		}