public void EnsureBaseline_ShouldCallCreateJournalAndSetBaseline() { var journal = new Mock <IJournal>(); journal.Setup(j => j.GetDeployedMigrations()).Returns(new List <DeployedMigration>()); var availableMigrations = new[] { _offlineMigration, _onlineMigration, new Migration(3, "SomeMigration", "0987654321", false, pr => { }), new Migration(4, "Later Migration", "111111111111111", false, pr => { }), }; var migrationsProvider = new FakeMigrationsProvider().WithMigrations(availableMigrations); var subject = new Migrator(journal.Object, migrationsProvider, Mock.Of <IProgressReporter>()); subject.EnsureBaseline("SomeMigration"); journal.Verify(j => j.CreateJournal(), Times.Once); journal.Verify( j => j.SetBaseline(It.Is <IEnumerable <Migration> >(actual => actual.SequenceEqual(availableMigrations.Take(3)))), Times.Once, "the first three migrations should have been sent to the journal" ); }