예제 #1
0
        public static IEvolveMetadata AssertVersionedMigrationSave(this IEvolveMetadata metadataTable)
        {
            metadataTable.SaveMigration(FileMigrationScriptV, true);
            Assert.True(metadataTable.GetAllMigrationMetadata().Count() == 1, $"1 migration metadata should have been found, instead of {metadataTable.GetAllMigrationMetadata().Count()}.");
            Assert.True(metadataTable.GetAllRepeatableMigrationMetadata().Count() == 0, $"0 repeatable migration metadata should have been found, instead of {metadataTable.GetAllRepeatableMigrationMetadata().Count()}.");
            var metadata = metadataTable.GetAllMigrationMetadata().First();

            Assert.True(metadata.Version == FileMigrationScriptV.Version, $"Migration metadata version should be: 2.3.1, but found {metadata.Version}.");
            Assert.True(metadata.Checksum == FileMigrationScriptV.CalculateChecksum(), $"Migration metadata checksum should be: 6C7E36422F79696602E19079534B4076, but found {metadata.Checksum}.");
            Assert.True(metadata.Description == FileMigrationScriptV.Description, $"Migration metadata description should be: Duplicate migration script, but found {metadata.Description}.");
            Assert.True(metadata.Name == FileMigrationScriptV.Name, $"Migration metadata name should be: V2_3_1__Duplicate_migration_script.sql, but found {metadata.Name}.");
            Assert.True(metadata.Success == true, $"Migration metadata success should be: true, but found {metadata.Success}.");
            if (!(metadataTable is CassandraMetadataTable))
            {
                Assert.True(metadata.Id == 2, $"Migration metadata id should be: 2, but found {metadata.Id}.");
            }
            Assert.True(metadata.Type == MetadataType.Migration, $"Migration metadata type should be: Migration, but found {metadata.Type}.");
            Assert.True(metadata.InstalledOn.Date == DateTime.UtcNow.Date, $"Migration metadata InstalledOn date {metadata.InstalledOn.Date} should be equals to {DateTime.UtcNow.Date}.");
            return(metadataTable);
        }
예제 #2
0
        public static IEvolveMetadata AssertRepeatableMigrationSave(this IEvolveMetadata metadataTable)
        {
            metadataTable.SaveMigration(FileMigrationScriptR, true);
            Assert.True(metadataTable.GetAllMigrationMetadata().Count() == 1, $"1 migration metadata should have been found, instead of {metadataTable.GetAllMigrationMetadata().Count()}.");
            Assert.True(metadataTable.GetAllRepeatableMigrationMetadata().Count() == 1, $"1 repeatable migration metadata should have been found, instead of {metadataTable.GetAllRepeatableMigrationMetadata().Count()}.");
            var metadata = metadataTable.GetAllRepeatableMigrationMetadata().First();

            Assert.True(metadata.Version == FileMigrationScriptR.Version, $"Repeatable migration metadata version should be: null, but found {metadata.Version}.");
            Assert.True(metadata.Checksum == FileMigrationScriptR.CalculateChecksum(), $"Repeatable migration metadata checksum should be; 71568061B2970A4B7C5160FE75356E10, but found {metadata.Checksum}.");
            Assert.True(metadata.Description == FileMigrationScriptR.Description, $"Repeatable migration metadata description should be: desc b, but found {metadata.Description}.");
            Assert.True(metadata.Name == FileMigrationScriptR.Name, $"Repeatable migration metadata name should be: R__desc_b.sql, but found {metadata.Name}.");
            Assert.True(metadata.Success == true, $"Repeatable migration metadata success should be: true, but found {metadata.Success}.");
            if (!(metadataTable is CassandraMetadataTable))
            {
                Assert.True(metadata.Id == 3, $"Repeatable migration metadata id should be: 3, but found {metadata.Id}.");
            }
            Assert.True(metadata.Type == MetadataType.RepeatableMigration, $"Repeatable migration metadata type should be: RepeatableMigration, but found {metadata.Type}.");
            Assert.True(metadata.InstalledOn.Date == DateTime.UtcNow.Date, $"Repeatable migration metadata InstalledOn date {metadata.InstalledOn.Date} should be equals to {DateTime.UtcNow.Date}.");
            return(metadataTable);
        }