Esempio n. 1
0
 public void TestCreateSQLiteTable()
 {
     using (IRepository sourceRepository = new SQLiteRepository(chinookSQLiteConnectionString))
     {
         var generator = new Generator4(sourceRepository, null, false, false, true);
         generator.GenerateTableScript("Album");
         var result = generator.GeneratedScript;
         var lines  = Regex.Split(result, "\r\n|\r|\n");
         Assert.AreEqual(10, lines.Length, result);
     }
 }
Esempio n. 2
0
 public void TestCreateSqliteUneditableTable()
 {
     using (IRepository sourceRepository = new SQLiteRepository(db21Conn))
     {
         var generator = new Generator4(sourceRepository, null, false, false, true);
         var tables    = sourceRepository.GetAllTableNames();
         generator.GenerateTableScript("Users");
         var result = generator.GeneratedScript;
         var lines  = Regex.Split(result, "\r\n|\r|\n");
         Assert.AreEqual(18, lines.Length, result);
     }
 }
Esempio n. 3
0
        public void TestServerExportUniqueIssue()
        {
            string path = @"C:\temp\E2E.sqlce";

            using (IRepository sourceRepository = new ServerDBRepository4(E2EConnectionString))
            {
                var generator = new Generator4(sourceRepository, path);
                generator.ExcludeTables(new List <string>());
                generator.GenerateTableScript("OneToOneSeparateFKDependent");
                var test = generator.GeneratedScript;
            }
        }
Esempio n. 4
0
        private void AssertMsSqlToSqliteGeneratorContains(string createTableQuery, string tableName, string expectedSql)
        {
            // connect to database server
            string connectionString = @"Data Source=.\sqlexpress;Integrated Security=SSPI;";

            // create a new random database name
            string databaseName = this.RandomString(10);

            using (SqlConnection sqlConnection = new SqlConnection(connectionString))
            {
                sqlConnection.Open();

                while (sqlConnection.DatabaseExists(databaseName))
                {
                    // create a new random database name
                    databaseName = this.RandomString(10);
                }

                using (TempDatabase tempDatabase = new TempDatabase(sqlConnection, databaseName))
                {
                    using (SqlConnection tempSqlConnection = new SqlConnection(tempDatabase.ConnectionString))
                    {
                        tempSqlConnection.Open();

                        tempSqlConnection.Execute(createTableQuery);
                    }

                    string sql = null;

                    using (var repository = new ServerDBRepository4(tempDatabase.ConnectionString, false))
                    {
                        Generator4 generator = new Generator4(
                            repository,
                            null,
                            false,
                            false,
                            true);
                        generator.GenerateTableScript(tableName);
                        sql = generator.GeneratedScript;
                    }

                    Assert.IsTrue(sql.Contains(expectedSql), sql);
                }
            }
        }
Esempio n. 5
0
 public void TestServerExportUniqueIssue()
 {
     string path = @"C:\temp\E2E.sqlce";
     using (IRepository sourceRepository = new ServerDBRepository4(E2EConnectionString))
     {
         var generator = new Generator4(sourceRepository, path);
         generator.ExcludeTables(new List<string>());
         generator.GenerateTableScript("OneToOneSeparateFKDependent");
         var test = generator.GeneratedScript;
     }
 }
Esempio n. 6
0
 public void TestCreateSQLiteTable()
 {
     using (IRepository sourceRepository = new SQLiteRepository(chinookSQLiteConnectionString))
     {
         var generator = new Generator4(sourceRepository, null, false, false, true);
         generator.GenerateTableScript("Album");
         var result = generator.GeneratedScript;
         var lines = Regex.Split(result, "\r\n|\r|\n");
         Assert.IsTrue(lines.Length == 11);
     }
 }