public static IEvolveMetadata AssertVersionedMigrationChecksumUpdate(this IEvolveMetadata metadataTable, int metadataId = 2) { metadataTable.UpdateChecksum(metadataId, "Hi !"); var metadata = metadataTable.GetAllAppliedMigration().Single(x => x.Id == metadataId); Assert.True(metadata.Checksum == "Hi !", $"Updated checksum should be: Hi!, but found {metadata.Checksum}"); return(metadataTable); }
public static IEvolveMetadata AssertVersionedMigrationSave(this IEvolveMetadata metadataTable) { metadataTable.SaveMigration(FileMigrationScriptV, true); Assert.True(metadataTable.GetAllAppliedMigration().Count() == 1, $"1 migration metadata should have been found, instead of {metadataTable.GetAllAppliedMigration().Count()}."); Assert.True(metadataTable.GetAllAppliedRepeatableMigration().Count() == 0, $"0 repeatable migration metadata should have been found, instead of {metadataTable.GetAllAppliedRepeatableMigration().Count()}."); var metadata = metadataTable.GetAllAppliedMigration().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); }
public static IEvolveMetadata AssertRepeatableMigrationSave(this IEvolveMetadata metadataTable) { metadataTable.SaveMigration(FileMigrationScriptR, true); Assert.True(metadataTable.GetAllAppliedMigration().Count() == 1, $"1 migration metadata should have been found, instead of {metadataTable.GetAllAppliedMigration().Count()}."); Assert.True(metadataTable.GetAllAppliedRepeatableMigration().Count() == 1, $"1 repeatable migration metadata should have been found, instead of {metadataTable.GetAllAppliedRepeatableMigration().Count()}."); var metadata = metadataTable.GetAllAppliedRepeatableMigration().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); }