/// <summary> /// Do not debug this test !! /// </summary> private async Task ShouldRecoverByUpdateMetadataOnceFullScenario(Func <IRequestContext, Task <IResponse> > fetchResponse) { var scenario = new RoutingScenario(); var cacheExpiration = TimeSpan.Zero; var router = scenario.CreateRouter(cacheExpiration); int partitionId = 0; var fetchRequest = new FetchRequest(); CreateSuccessfulSendMock(scenario); //Send Successful Message await router.SendAsync(fetchRequest, RoutingScenario.TestTopic, partitionId, CancellationToken.None); Assert.That(scenario.Connection1[ApiKey.Fetch], Is.EqualTo(1), "RequestCallCount(ApiKey.Fetch)"); Assert.That(scenario.Connection1[ApiKey.Metadata], Is.EqualTo(1), "RequestCallCount(ApiKey.Metadata)"); Assert.That(scenario.Connection2[ApiKey.Metadata], Is.EqualTo(0), "RequestCallCount(ApiKey.Metadata)"); scenario.Connection1.Add(ApiKey.Fetch, fetchResponse); //triger to update metadata scenario.Connection1.Add(ApiKey.Metadata, async _ => await RoutingScenario.MetaResponseWithException()); scenario.Connection2.Add(ApiKey.Metadata, async _ => await RoutingScenario.MetadataResponseWithSingleBroker()); //Reset variables scenario.Connection1[ApiKey.Fetch] = 0; scenario.Connection2[ApiKey.Fetch] = 0; scenario.Connection1[ApiKey.Metadata] = 0; scenario.Connection2[ApiKey.Metadata] = 0; //Send Successful Message that was recover from exception await router.SendAsync(fetchRequest, RoutingScenario.TestTopic, partitionId, CancellationToken.None); Assert.That(scenario.Connection1[ApiKey.Fetch], Is.EqualTo(1), "RequestCallCount(ApiKey.Fetch)"); Assert.That(scenario.Connection1[ApiKey.Metadata], Is.EqualTo(1), "RequestCallCount(ApiKey.Metadata)"); Assert.That(scenario.Connection2[ApiKey.Fetch], Is.EqualTo(1), "RequestCallCount(ApiKey.Fetch)"); Assert.That(scenario.Connection2[ApiKey.Metadata], Is.EqualTo(1), "RequestCallCount(ApiKey.Metadata)"); }