public void SetUp() { testDBType = Convert.ToInt32(ConfigurationManager.AppSettings["TestDBType"]); switch (testDBType) { case 1: // SQLite In-Memory TestDatabase = new InMemoryDatabase(); break; case 2: // SQL Local DB TestDatabase = new SQLLocalDatabase(); break; case 3: // SQL Server case 4: // SQL CE case 5: // MySQL case 6: // Oracle case 7: // Postgres Assert.Fail("Database platform not supported for unit testing"); return; case 8: // Firebird TestDatabase = new FirebirdDatabase(); break; default: Assert.Fail("Unknown database platform specified: " + testDBType); return; } }
public void SetUp() { var testDBType = Convert.ToInt32(ConfigurationManager.AppSettings["TestDBType"]); switch (testDBType) { case 1: // SQLite In-Memory TestDatabase = new InMemoryDatabase(); Database = new Database(TestDatabase.Connection); break; case 2: // SQL Local DB TestDatabase = new SQLLocalDatabase(); Database = new Database(TestDatabase.Connection, new SqlServer2012DatabaseType(), 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 Assert.Fail("Database platform not supported for unit testing"); return; default: Assert.Fail("Unknown database platform specified"); return; } // Insert test data InsertData(); }
public void SetUp() { var types = new[] { typeof(User), typeof(ExtraUserInfo), typeof(Usersss), typeof(House), typeof(Supervisor) }; var dbFactory = new DatabaseFactory(); dbFactory.Config().WithFluentConfig( FluentMappingConfiguration.Scan(s => { s.Assembly(typeof(User).Assembly); s.IncludeTypes(types.Contains); s.WithSmartConventions(); s.Columns.ResultWhere(y => ColumnInfo.FromMemberInfo(y).IgnoreColumn); s.OverrideMappingsWith(new FluentMappingOverrides()); }) ); var testDBType = Convert.ToInt32(ConfigurationManager.AppSettings["TestDBType"]); switch (testDBType) { case 1: // SQLite In-Memory TestDatabase = new InMemoryDatabase(); Database = dbFactory.Build(new Database(TestDatabase.Connection)); break; case 2: // SQL Local DB case 3: // SQL Server TestDatabase = new SQLLocalDatabase(); Database = dbFactory.Build(new Database(TestDatabase.Connection, new SqlServer2008DatabaseType() { UseOutputClause = true })); break; case 4: // SQL CE case 5: // MySQL case 6: // Oracle case 7: // Postgres Assert.Fail("Database platform not supported for unit testing"); return; case 8: // Firebird TestDatabase = new FirebirdDatabase(); var db = new Database(TestDatabase.Connection, new FirebirdDatabaseType()); db.Mapper = new FirebirdDefaultMapper(); Database = dbFactory.Build(db); break; default: Assert.Fail("Unknown database platform specified"); return; } InsertData(); }
public void SetUp() { var types = new[] { typeof(User), typeof(ExtraUserInfo), typeof(Usersss), typeof(House), typeof(Supervisor) }; var dbFactory = new DatabaseFactory(); dbFactory.Config().WithFluentConfig( FluentMappingConfiguration.Scan(s => { s.Assembly(typeof (User).Assembly); s.IncludeTypes(types.Contains); s.WithSmartConventions(); s.Columns.ResultWhere(y => ColumnInfo.FromMemberInfo(y).IgnoreColumn); s.OverrideMappingsWith(new FluentMappingOverrides()); }) ); var testDBType = Convert.ToInt32(ConfigurationManager.AppSettings["TestDBType"]); switch (testDBType) { case 1: // SQLite In-Memory TestDatabase = new InMemoryDatabase(); Database = dbFactory.Build(new Database(TestDatabase.Connection)); break; case 2: // SQL Local DB case 3: // SQL Server TestDatabase = new SQLLocalDatabase(); Database = dbFactory.Build(new Database(TestDatabase.Connection, new SqlServer2008DatabaseType())); break; case 4: // SQL CE case 5: // MySQL case 6: // Oracle case 7: // Postgres Assert.Fail("Database platform not supported for unit testing"); return; case 8: // Firebird TestDatabase = new FirebirdDatabase(); var db = new Database(TestDatabase.Connection, new FirebirdDatabaseType()); db.Mapper = new FirebirdDefaultMapper(); Database = dbFactory.Build(db); break; default: Assert.Fail("Unknown database platform specified"); return; } InsertData(); }
public void SetUp() { var configuration = new ConfigurationBuilder() .AddJsonFile("config.json") .Build(); //DatabaseFactory.ColumnSerializer = new JsonNetColumnSerializer(); var testDBType = Convert.ToInt32(configuration.GetSection("TestDBType").Value); switch (testDBType) { case 1: // SQLite In-Memory TestDatabase = new InMemoryDatabase(); Database = new Database(TestDatabase.Connection); break; case 2: // SQL Local DB var dataSource = configuration.GetSection("TestDbDataSource").Value; TestDatabase = new SQLLocalDatabase(dataSource); Database = new Database(TestDatabase.Connection, new SqlServer2008DatabaseType() { UseOutputClause = false }, 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 Assert.Fail("Database platform not supported for unit testing"); return; #if !DNXCORE50 case 8: // Firebird TestDatabase = new FirebirdDatabase(); Database = new Database(TestDatabase.Connection, new FirebirdDatabaseType(), IsolationLevel.ReadUncommitted); break; #endif default: Assert.Fail("Unknown database platform specified"); return; } // Insert test data InsertData(); }
public void SetUp() { var types = new[] { typeof(User), typeof(ExtraUserInfo) }; var dbFactory = new DatabaseFactory(); dbFactory.Config().WithFluentConfig( FluentMappingConfiguration.Scan(s => { s.Assembly(typeof(User).Assembly); s.IncludeTypes(types.Contains); s.WithSmartConventions(); s.OverrideMappingsWith(new FluentMappingOverrides()); }) ); var testDBType = Convert.ToInt32(ConfigurationManager.AppSettings["TestDBType"]); switch (testDBType) { case 1: // SQLite In-Memory TestDatabase = new InMemoryDatabase(); Database = dbFactory.Build(new Database(TestDatabase.Connection)); break; case 2: // SQL Local DB case 3: // SQL Server TestDatabase = new SQLLocalDatabase(); Database = dbFactory.Build(new Database(TestDatabase.Connection, new SqlServer2008DatabaseType())); break; case 4: case 5: case 6: Assert.Fail("Database platform not supported for unit testing"); return; default: Assert.Fail("Unknown database platform specified"); return; } InsertData(); }
public void SetUp() { var types = new[] { typeof(User), typeof(ExtraUserInfo) }; var dbFactory = new DatabaseFactory(); dbFactory.Config().WithFluentConfig( FluentMappingConfiguration.Scan(s => { s.Assembly(typeof (User).Assembly); s.IncludeTypes(types.Contains); s.WithSmartConventions(); s.OverrideMappingsWith(new FluentMappingOverrides()); }) ); var testDBType = Convert.ToInt32(ConfigurationManager.AppSettings["TestDBType"]); switch (testDBType) { case 1: // SQLite In-Memory TestDatabase = new InMemoryDatabase(); Database = dbFactory.Build(new Database(TestDatabase.Connection)); break; case 2: // SQL Local DB case 3: // SQL Server TestDatabase = new SQLLocalDatabase(); Database = dbFactory.Build(new Database(TestDatabase.Connection, new SqlServer2012DatabaseType())); break; case 4: case 5: case 6: Assert.Fail("Database platform not supported for unit testing"); return; default: Assert.Fail("Unknown database platform specified"); return; } InsertData(); }
public void SetUp() { var types = new[] { typeof(User), typeof(ExtraUserInfo), typeof(UserWithExtraInfo), typeof(Usersss), typeof(House), typeof(Supervisor) }; var dbFactory = new DatabaseFactory(); //DatabaseFactory.ColumnSerializer = new JsonNetColumnSerializer(); var config = FluentMappingConfiguration.Scan(s => { s.Assembly(typeof(User).GetTypeInfo().Assembly); s.IncludeTypes(types.Contains); s.PrimaryKeysNamed(y => ToLowerIf(y.Name + "Id", false)); s.TablesNamed(y => ToLowerIf(Inflector.MakePlural(y.Name), false)); s.Columns.Named(x => ToLowerIf(x.Name, false)); s.Columns.ForceDateTimesToUtcWhere(x => x.GetMemberInfoType() == typeof(DateTime) || x.GetMemberInfoType() == typeof(DateTime?)); s.Columns.ResultWhere(y => ColumnInfo.FromMemberInfo(y).ResultColumn); s.OverrideMappingsWith(new FluentMappingOverrides()); s.OverrideMappingsWith(new OneToManyMappings()); }); dbFactory.Config().WithFluentConfig(config); var configuration = new ConfigurationBuilder() .AddJsonFile("config.json") .Build(); var testDBType = Convert.ToInt32(configuration.GetSection("TestDBType").Value); switch (testDBType) { case 1: // SQLite In-Memory TestDatabase = new InMemoryDatabase(); Database = dbFactory.Build(new Database(TestDatabase.Connection)); break; case 2: // SQL Local DB case 3: // SQL Server var dataSource = configuration.GetSection("TestDbDataSource").Value; TestDatabase = new SQLLocalDatabase(dataSource); Database = dbFactory.Build(new Database(TestDatabase.Connection, new SqlServer2008DatabaseType())); break; case 4: // SQL CE case 5: // MySQL case 6: // Oracle case 7: // Postgres Assert.Fail("Database platform not supported for unit testing"); return; #if !DNXCORE50 case 8: // Firebird TestDatabase = new FirebirdDatabase(); var db = new Database(TestDatabase.Connection, new FirebirdDatabaseType()); db.Mappers.Insert(0, new FirebirdDefaultMapper()); Database = dbFactory.Build(db); break; #endif default: Assert.Fail("Unknown database platform specified"); return; } InsertData(); }
public void SetUp() { var types = new[] { typeof(User), typeof(ExtraUserInfo), typeof(UserWithExtraInfo), typeof(Usersss), typeof(House), typeof(Supervisor) }; var dbFactory = new DatabaseFactory(); var config = FluentMappingConfiguration.Scan(s => { s.Assembly(typeof(User).GetTypeInfo().Assembly); s.IncludeTypes(types.Contains); s.PrimaryKeysNamed(y => ToLowerIf(y.Name + "Id", false)); s.TablesNamed(y => ToLowerIf(Inflector.MakePlural(y.Name), false)); s.Columns.Named(x => ToLowerIf(x.Name, false)); s.Columns.ForceDateTimesToUtcWhere(x => x.GetMemberInfoType() == typeof(DateTime) || x.GetMemberInfoType() == typeof(DateTime?)); s.Columns.ResultWhere(y => ColumnInfo.FromMemberInfo(y).ResultColumn); s.OverrideMappingsWith(new FluentMappingOverrides()); s.OverrideMappingsWith(new OneToManyMappings()); }); dbFactory.Config().WithFluentConfig(config); var configuration = new ConfigurationBuilder() .AddJsonFile("config.json") .Build(); var testDBType = Convert.ToInt32(configuration.GetSection("TestDBType").Value); switch (testDBType) { case 1: // SQLite In-Memory TestDatabase = new InMemoryDatabase(); Database = dbFactory.Build(new Database(TestDatabase.Connection)); break; case 2: // SQL Local DB case 3: // SQL Server var dataSource = configuration.GetSection("TestDbDataSource").Value; TestDatabase = new SQLLocalDatabase(dataSource); Database = dbFactory.Build(new Database(TestDatabase.Connection, new SqlServer2008DatabaseType())); break; case 4: // SQL CE case 5: // MySQL case 6: // Oracle case 7: // Postgres Assert.Fail("Database platform not supported for unit testing"); return; #if !DNXCORE50 case 8: // Firebird TestDatabase = new FirebirdDatabase(); var db = new Database(TestDatabase.Connection, new FirebirdDatabaseType()); db.Mappers.Insert(0, new FirebirdDefaultMapper()); Database = dbFactory.Build(db); break; #endif default: Assert.Fail("Unknown database platform specified"); return; } InsertData(); }
public void SetUp() { var configuration = new ConfigurationBuilder() .AddJsonFile("config.json") .Build(); var testDBType = Convert.ToInt32(configuration.GetSection("TestDBType").Value); switch (testDBType) { case 1: // SQLite In-Memory TestDatabase = new InMemoryDatabase(); Database = new Database(TestDatabase.Connection); break; case 2: // SQL Local DB TestDatabase = new SQLLocalDatabase(); Database = new Database(TestDatabase.Connection, new SqlServer2008DatabaseType() { UseOutputClause = false }, SqlClientFactory.Instance, 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 Assert.Fail("Database platform not supported for unit testing"); return; #if !DNXCORE50 case 8: // Firebird TestDatabase = new FirebirdDatabase(); Database = new Database(TestDatabase.Connection, new FirebirdDatabaseType(), FirebirdClientFactory.Instance, IsolationLevel.ReadUncommitted); break; #endif default: Assert.Fail("Unknown database platform specified"); return; } // Insert test data InsertData(); }
public void SetUp() { var configuration = new ConfigurationBuilder() .AddJsonFile("config.json") .Build(); testDBType = Convert.ToInt32(configuration.GetSection("TestDBType").Value); switch (testDBType) { case 1: // SQLite In-Memory TestDatabase = new InMemoryDatabase(); break; case 2: // SQL Local DB var dataSource = configuration.GetSection("TestDbDataSource").Value; TestDatabase = new SQLLocalDatabase(dataSource); break; case 3: // SQL Server case 4: // SQL CE case 5: // MySQL case 6: // Oracle case 7: // Postgres Assert.Fail("Database platform not supported for unit testing"); return; #if !DNXCORE50 case 8: // Firebird TestDatabase = new FirebirdDatabase(); break; #endif default: Assert.Fail("Unknown database platform specified: " + testDBType); return; } }