Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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
            }
        }