Esempio n. 1
0
        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;
            }
        }
Esempio n. 2
0
        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;

            case 8:     // Firebird
                TestDatabase = new FirebirdDatabase();
                break;

            default:
                Assert.Fail("Unknown database platform specified: " + testDBType);
                return;
            }
        }