Пример #1
0
        public async void HandlingExceptionAsynchroniouslyOnSynchroneApi()
        {
            var api = new SynchroneAPI();
            IAsynchroniousWrapper <int> runner = FILL_ME_IN;
            await runner.Run();

            Assert.Equal(TaskStatus.Faulted, runner.Handler.Task.Status);
            Assert.IsType <AggregateException>(runner.Handler.Task.Exception);
            Assert.IsType <TimeoutException>(runner.Handler.Task.Exception.InnerException);
        }
Пример #2
0
        public async void WritingResultAsynchroniouslyOnSynchroneApi()
        {
            int expectedValue = 42;
            var api           = new SynchroneAPI();
            IAsynchroniousWrapper <int> runner = FILL_ME_IN;
            await runner.Run();

            int result = runner.Handler.Task.Result;

            Assert.Equal(expectedValue, result);
        }