public async Task AbleToMigrate_delayed_delivery_does_not_exist_should_indicate_problems() { var sut = new SqlTTimeoutsTarget(new TestLoggingAdapter(), connectionString, schema); await using var connection = new SqlConnection(connectionString); await connection.OpenAsync(); await using var command = connection.CreateCommand(); command.CommandText = string.Format(@" IF OBJECT_ID('{0}.{1}', 'u') IS NOT NULL DROP TABLE {0}.{1}; ", $"{ExistingEndpointName}.Delayed", schema); await command.ExecuteNonQueryAsync(); var info = new EndpointInfo { EndpointName = ExistingEndpointName, ShortestTimeout = DateTime.UtcNow.AddDays(3), LongestTimeout = DateTime.UtcNow.AddDays(5), Destinations = new List <string> { ExistingDestination } }; var result = await sut.AbleToMigrate(info); Assert.IsFalse(result.CanMigrate); }
public async Task AbleToMigrate_delayed_delivery_does_exist_should_indicate_no_problems() { var sut = new SqlTTimeoutsTarget(new TestLoggingAdapter(), connectionString, schema); await using var connection = new SqlConnection(connectionString); await connection.OpenAsync(); await using var command = connection.CreateCommand(); command.CommandText = string.Format(@" CREATE TABLE [{1}].[{0}] ( RowVersion bigint IDENTITY(1,1) NOT NULL ); ", $"{ExistingEndpointName}.Delayed", schema); await command.ExecuteNonQueryAsync(); var info = new EndpointInfo { EndpointName = ExistingEndpointName, ShortestTimeout = DateTime.UtcNow.AddDays(3), LongestTimeout = DateTime.UtcNow.AddDays(5), Destinations = new List <string> { ExistingDestination } }; var result = await sut.AbleToMigrate(info); Assert.IsTrue(result.CanMigrate); }