Example #1
0
        public void Run_should_create_schema_migrations_table_if_it_doesnt_exist()
        {
            //  arrange
            _mockMigrationDir.Setup(dir => dir.GetScripts()).Returns(Enumerable.Empty <IMigrationScriptFile>);

            //  act
            _versionCommand.Run(_commandArgs);

            //  assert
            using (var sql = new SqlDatabaseHelper(TestConnectionString))
            {
                var r =
                    sql.ExecuteScalar <int>(
                        "SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='schema_migrations'");
                Assert.IsTrue(r == 1);
            }
        }