示例#1
0
        public async Task TestThrowInSubTask()
        {
            var obj   = new ThrowExceptionTester();
            var proxy = ProxyGenerator.CreateClassProxy <ThrowExceptionTester>();

            Assert.True(proxy.IsProxy());

            await AssertSameThrowsAsync(
                async() => await obj.ThrowInSubTask(),
                async() => await proxy.ThrowInSubTask());
        }
示例#2
0
        public async Task TestThrowInUncontinuedTasks()
        {
            var obj   = new ThrowExceptionTester();
            var proxy = ProxyGenerator.CreateClassProxy <ThrowExceptionTester>();

            Assert.True(proxy.IsProxy());

            // todo re-test
            // await AssertSameThrowsAsync(
            //     async () => await obj.ThrowInUncontinuedTasks(),
            //     async () => await proxy.ThrowInUncontinuedTasks());
        }
示例#3
0
        public async Task TestThrowException()
        {
            var obj   = new ThrowExceptionTester();
            var proxy = ProxyGenerator.CreateClassProxy <ThrowExceptionTester>();

            Assert.True(proxy.IsProxy());

            AssertSameThrows(
                () => obj.ThrowOfResult(),
                () => proxy.ThrowOfResult());

            await AssertSameThrowsAsync(
                async() => await obj.ThrowAsyncOfTaskResult(),
                async() => await proxy.ThrowAsyncOfTaskResult());

            await AssertSameThrowsAsync(
                async() => await obj.ThrowAsyncOfValueTask(),
                async() => await proxy.ThrowAsyncOfValueTask());
        }