public void MigratorShouldThrowExceptionIfMetadataHasWrongFileName() { var databuilder = new MigrationMetadataBuilder(); var location = Assembly.GetExecutingAssembly(); var migrationMetadata = databuilder.WithAssignedTo(typeof(MigrationWithEmptyFile)) .WithLocation(location).Build(); var metadataLoader = new MigrationsMetadataLoaderBuilder().WithMetadata(migrationMetadata).Build(); Assert.Throws <MigrationFileNotFoundException>(() => _validator.Validate(metadataLoader.Get())); }
public void MigratorShouldThrowExceptionAsMigrationDidnotAddMetadata() { var databuilder = new NullMigrationMetadataBuilder(); var location = Assembly.GetExecutingAssembly(); var migrationMetadata = databuilder .WithAssignedTo(typeof(MigrationWithoutHasNoAttribute)) .WithLocation(location).Build(); var metadataLoader = new MigrationsMetadataLoaderBuilder().WithMetadata(migrationMetadata).Build(); Assert.Throws <AttributeNotAssignedException>(() => _validator.Validate(metadataLoader.Get())); }
public void MigratorShouldNotThrowExceptionIfWhaveValidMigrations() { var databuilder = new MigrationMetadataBuilder(); var migrationMetadata = databuilder.WithAssignedTo(typeof(GoodMigration)) .WithLocation(Assembly.GetExecutingAssembly()) .WithFileName("good-file.json") .WithProjectionName("test-proj") .WithOrder(1) .Build(); var metadataLoader = new MigrationsMetadataLoaderBuilder().WithMetadata(migrationMetadata).Build(); _validator.Validate(metadataLoader.Get()); }