/// <inheritdoc cref="IEventHubReceiver"/> public async Task <IEnumerable <EventData> > ReceiveAsync(int maxCount, TimeSpan waitTime) { IEnumerable <EventData> events; //mimic real life response time await Task.Delay(TimeSpan.FromMilliseconds(30)); if (generator.TryReadEvents(maxCount, out events)) { return(events); } //if no events generated, wait for waitTime to pass await Task.Delay(waitTime); return(new List <EventData>().AsEnumerable()); }