How can I unit test transfer FluentMigrator?

General tip: I should always check the migration of my database, but how to do this seems to be well kept secret;)

My selected structure is FluentMigration.

I think I want to do this:

  • Migrate the database to N-1.
  • Save some data.
  • Migrating the database to N.
  • Read the data and make sure that it is not lost.
  • Check out other relevant changes.

But I can’t understand how to perform migrations from my unit tests.

+5
source share
1 answer

To start the migration in your integration tests, simply open the migrate.exe command using Process.Start

for instance

var migrator = System.Diagnostics.Process.Start("migrator.exe", "/connection \"Data Source=db\\db.sqlite;Version=3;\" /db sqlite /target your.migrations.dll");
migrator.WaitForExit();

MSTest, , migrator.exe , .exe, .

+2

All Articles