public async Task AbleToMigrate_TimeoutHigherThan9Years_ReturnsProblems() { var sut = new RabbitMqTimeoutTarget(new TestLoggingAdapter(), rabbitUrl); var info = new EndpointInfo { EndpointName = ExistingEndpointNameUsingConventional, ShortestTimeout = DateTime.UtcNow.AddDays(3), LongestTimeout = DateTime.UtcNow.AddYears(9), Destinations = new List <string> { ExistingEndpointNameUsingConventional } }; var result = await sut.AbleToMigrate(info); Assert.IsFalse(result.CanMigrate); }
public async Task Should_handle_negative_delays() { const int BatchNumber = 33; var sut = new RabbitMqTimeoutTarget(new TestLoggingAdapter(), rabbitUrl); var info = new EndpointInfo { EndpointName = ExistingEndpointNameUsingConventional, ShortestTimeout = DateTime.UtcNow.AddDays(3), LongestTimeout = DateTime.UtcNow.AddDays(5), Destinations = new List <string> { ExistingEndpointNameUsingConventional } }; var migrateResult = await sut.AbleToMigrate(info); Assert.IsTrue(migrateResult.CanMigrate); await using var endpointTarget = await sut.PrepareTargetEndpointBatchMigrator(ExistingEndpointNameUsingConventional); await endpointTarget.StageBatch(new List <TimeoutData> { new TimeoutData { Id = "SomeID", Headers = new Dictionary <string, string>(), Destination = ExistingEndpointNameUsingConventional, State = new byte[2], Time = DateTime.Now - TimeSpan.FromDays(1) } }, BatchNumber); var numPumped = await sut.CompleteBatch(BatchNumber); Assert.AreEqual(1, numPumped); using var connection = factory.CreateConnection(); using var channel = connection.CreateModel(); var result = channel.BasicGet(ExistingEndpointNameUsingConventional, true); Assert.NotNull(result); Assert.AreEqual(0, result.MessageCount); }
public async Task AbleToMigrate_DelayedDeliveryDoesNotExist_ReturnsProblems() { var sut = new RabbitMqTimeoutTarget(new TestLoggingAdapter(), rabbitUrl); DeleteDelayDelivery(); var info = new EndpointInfo { EndpointName = ExistingEndpointNameUsingConventional, ShortestTimeout = DateTime.UtcNow.AddDays(3), LongestTimeout = DateTime.UtcNow.AddDays(5), Destinations = new List <string> { ExistingEndpointNameUsingConventional, ExistingEndpointNameUsingDirect } }; var result = await sut.AbleToMigrate(info); Assert.IsFalse(result.CanMigrate); }