public void InvalidMigrationsPopulated()
        {
            var migrations = new[]
                                 {
                                     new KeyValuePair<long,IMigration>(1, new TestMigration1()),
                                     new KeyValuePair<long,IMigration>(2, new TestMigration2())
                                 };

            var exception = new VersionOrderInvalidException(migrations);

            exception.InvalidMigrations.ShouldBe(migrations);
        }
        public void InvalidMigrationsPopulated()
        {
            var migrations = new[]
                                 {
                                     new KeyValuePair<long,IMigrationInfo>(1, new MigrationInfo(1, TransactionBehavior.Default, false, new TestMigration1())),
                                     new KeyValuePair<long,IMigrationInfo>(2, new MigrationInfo(2, TransactionBehavior.Default, false, new TestMigration2()))
                                 };

            var exception = new VersionOrderInvalidException(migrations);

            exception.InvalidMigrations.ShouldBe(migrations);
        }
        public void ExceptionMessageListsInvalidMigrations()
        {
            var migrations = new[]
                                 {
                                     new KeyValuePair<long,IMigrationInfo>(1, new MigrationInfo(1, TransactionBehavior.Default, new TestMigration1())),
                                     new KeyValuePair<long,IMigrationInfo>(2, new MigrationInfo(2, TransactionBehavior.Default, new TestMigration2()))
                                 };

            var exception = new VersionOrderInvalidException(migrations);

            var expectedMessage = "Unapplied migrations have version numbers that are less than the greatest version number of applied migrations:"
                + Environment.NewLine + "1 - TestMigration1"
                + Environment.NewLine + "2 - TestMigration2";

            System.Console.WriteLine(exception.Message);

            exception.Message.ShouldBe(expectedMessage);
        }
        public void ExceptionMessageListsInvalidMigrationsWrappedByMigrationWithMetaDataAdapter()
        {
            var migrations = new[]
                                 {
                                     new KeyValuePair<long,IMigration>(1, new MigrationWithMetaDataAdapter(new TestMigration1(), new MigrationMetadata())),
                                     new KeyValuePair<long,IMigration>(2, new MigrationWithMetaDataAdapter(new TestMigration2(), new MigrationMetadata()))
                                 };

            var exception = new VersionOrderInvalidException(migrations);

            var expectedMessage = "Unapplied migrations have version numbers that are less than the greatest version number of applied migrations:"
                + Environment.NewLine + "1 - TestMigration1"
                + Environment.NewLine + "2 - TestMigration2";

            System.Console.WriteLine(exception.Message);

            exception.Message.ShouldBe(expectedMessage);
        }