public void CallsUpdate(DbAuthType authType)
                {
                    TestConstants.ConfigureRequest(Request, authType);

                    var underTest = new UpdateMigrationAction(MigratorFactory.Object);

                    underTest.Migrate(Request, Result);

                    Migrator.Verify(m => m.Update(), Times.Once);
                }
                public void AddsMessage(DbAuthType authType)
                {
                    TestConstants.ConfigureRequest(Request, authType);

                    var underTest = new UpdateMigrationAction(MigratorFactory.Object);

                    underTest.Migrate(Request, Result);

                    Assert.Contains("EF Plugin: There were no model changes found so no migrations applied",
                                    Result.InfoMessages);
                }
                public void RetrievesLastMigration(DbAuthType authType, string connString)
                {
                    TestConstants.ConfigureRequest(Request, authType);

                    var underTest = new UpdateMigrationAction(MigratorFactory.Object);

                    underTest.Migrate(Request, Result);

                    MigratorFactory.Verify(m => m.CreateMigrator(connString), Times.Once);
                    Migrator.Verify(m => m.GetLocalMigrations(), Times.Once);
                }
                public void AddsExecutionMessages(DbAuthType authType)
                {
                    TestConstants.ConfigureRequest(Request, authType);

                    var underTest = new UpdateMigrationAction(MigratorFactory.Object);

                    underTest.Migrate(Request, Result);

                    Assert.Contains($"EF Plugin: Successfully executed EF migration up to '{lastMigration}'", Result.InfoMessages);
                    Assert.Contains("EF Plugin: Added record to migration mapping history", Result.InfoMessages);
                }
                public void EnsuresMigrationRecordExistsForNewVersion(DbAuthType authType, string connString)
                {
                    TestConstants.ConfigureRequest(Request, authType);

                    var underTest = new UpdateMigrationAction(MigratorFactory.Object);

                    underTest.Migrate(Request, Result);

                    MigratorFactory.Verify(m => m.CreateDbContext(connString), Times.Once);
                    Repo.Verify(m => m.AddOrUpdate(TestConstants.VerAlias, lastMigration), Times.Once);
                    Context.Verify(m => m.SaveChanges());
                }
                public void MovesMigrationForward(DbAuthType authType, string connString)
                {
                    TestConstants.ConfigureRequest(Request, authType);
                    MigratorFactory.Setup(m => m.CreateMigrator(connString)).Returns(Migrator.Object);

                    var underTest = new UpdateMigrationAction(MigratorFactory.Object);

                    underTest.Migrate(Request, Result);

                    MigratorFactory.Verify(m => m.CreateDbContext(connString), Times.Once);
                    MigratorFactory.Verify(m => m.CreateMigrationRepository(Context.Object), Times.Once);
                    Repo.Verify(m => m.Copy(It.IsAny <string>(), It.IsAny <string>()), Times.Once);
                    Repo.Verify(m => m.Copy(TestConstants.PreviousVersion, TestConstants.VerAlias), Times.Once);
                    Migrator.Verify(m => m.GetLocalMigrations(), Times.Once);
                }