public void GetAppliedMigrations_finds_migrations()
        {
            var testConnection = SqliteTestConnection.CreateScratch();
            testConnection.Open();
            using (var command = testConnection.DbConnection.CreateCommand())
            {
                command.CommandText = CreateSqliteHistoryRepo().Create(true);
                command.ExecuteNonQuery();
            }
            using (var command = testConnection.DbConnection.CreateCommand())
            {
                command.CommandText = "INSERT INTO __migrationHistory VALUES ('different_context','SomeFakeContext','1');";
                command.ExecuteNonQuery();
            }

            var row = new HistoryRow("Mig1", "7");
            using (var command = testConnection.DbConnection.CreateCommand())
            {
                var operation = CreateSqliteHistoryRepo()
                    .GetInsertOperation(row) as SqlOperation;
                command.CommandText = operation?.Sql;
                command.ExecuteNonQuery();
            }

            var hp = new SqliteHistoryRepository(testConnection, new TestContext(), new SqliteUpdateSqlGenerator());

            Assert.Collection(hp.GetAppliedMigrations(), p =>
                {
                    Assert.Equal(row.MigrationId, p.MigrationId);
                    Assert.Equal(row.ProductVersion, p.ProductVersion);
                });
            testConnection.Close();
        }
        public void Exists_finds_existing_table()
        {
            var connection = SqliteTestConnection.CreateScratch();
            connection.Open();
            using (var cmd = connection.DbConnection.CreateCommand())
            {
                cmd.CommandText = "CREATE TABLE __migrationHistory (column1);";
                connection.Open();
                cmd.ExecuteNonQuery();
            }

            var hp = new SqliteHistoryRepository(connection, new TestContext(), new SqliteUpdateSqlGenerator());

            Assert.True(hp.Exists());
        }
        public void Exists_no_table()
        {
            var connection = SqliteTestConnection.CreateScratch();

            var hp = new SqliteHistoryRepository(connection, new TestContext(), new SqliteUpdateSqlGenerator());

            Assert.False(hp.Exists());
        }