public async Task Should_receive_progress_stream_of_known_size() { var stream = _migo.GetProgressStream(_tokenSource.Token); var counter = await RunStreamTest(stream) .ConfigureAwait(false); counter.Should().Be(TestStreamSize); }
private async Task OnProgressUpdate(Migo migo, CancellationToken token) { try { var(left, top) = Console.GetCursorPosition(); await foreach (var percentResult in migo.GetProgressStream(token)) { Console.Write($"{percentResult.Percent.ToString()}%"); Console.SetCursorPosition(left, top); } } catch (TaskCanceledException _) { // ignore } }