public async Task Exchange_should_retry_health_update_send_in_case_of_errors()
        {
            var count     = 10;
            var countdown = new AsyncCountdown(nameof(IHealthMonitorExchangeClient.UploadHealthAsync), count);

            SetupDefaultRegisterEndpointsMock();
            var identity = SetupDefaultEndpointIdentitiesMock().First();

            var attempts = 10;

            SetupDefaultHealthUploadMock(updates =>
            {
                if (attempts-- > 0)
                {
                    throw new Exception();
                }

                foreach (var update in updates)
                {
                    countdown.Decrement();
                }
            });


            var config = new DataExchangeConfig(100, count, TimeSpan.FromMilliseconds(1), TimeSpan.FromSeconds(1), EndpointMetadata.DefaultMonitorTag);

            var healths = PrepareEndpointHealths(count);

            using (var ex = CreateExchange(config))
            {
                foreach (var health in healths)
                {
                    ex.UpdateHealth(identity.Id, health);
                }

                await countdown.WaitAsync(TestMaxWaitTime);
            }
        }
 private MonitorDataExchange CreateExchange(DataExchangeConfig config)
 {
     return(new MonitorDataExchange(_monitorRegistry, _exchangeClient.Object, _endpointRegistry.Object, config));
 }