Skip to content

Instantly share code, notes, and snippets.

@dcrosby42
Created February 1, 2011 05:05
Show Gist options
  • Save dcrosby42/805445 to your computer and use it in GitHub Desktop.
Save dcrosby42/805445 to your computer and use it in GitHub Desktop.
Sample code for a migration test using C# and MigratorDotNet for an ASP.NET MVC 2 web app
namespace UnitTests
{
public class FullMigrationTest
{
public static string[] AllExpectedTables = new[]
{
"BlogPost",
"Attachment",
"Photo",
// aspnet auth stuff:
"aspnet_Applications",
"aspnet_Membership",
"aspnet_Profile",
"aspnet_Roles",
"aspnet_SchemaVersions",
"aspnet_Users",
"aspnet_UsersInRoles",
"SchemaInfo",
};
[Test]
public void all_migrations_should_run_successfully()
{
MigrationTestHelper.MigrateAllTheWayDown();
MigrationTestHelper.MigrateAllTheWayUp();
var tablesInDatabase = GetTablesInDatabase();
Want(tablesInDatabase).ToHaveSameItemsAs(AllExpectedTables);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment