Exemple #1
0
        public void Invoke_TaskAsyncWithException_InTask()
        {
            var          ctx = new ServerSideAsyncDomainContext(TestURIs.ServerSideAsync);
            const int    expectedErrorCode = 24;
            const string expectedMessage   = "InvokeWithExceptionTask";

            var invoke = ctx.InvokeWithException(delay: 3);

            this.EnqueueConditional(() => invoke.IsCompleted);
            this.EnqueueCallback(() =>
            {
                Assert.IsNotNull(invoke.Exception, "Exception is null");
                var dex = ((DomainException)invoke.Exception.InnerException);

                Assert.AreEqual(expectedErrorCode, dex.ErrorCode, "Wrong error code");
                Assert.AreEqual(expectedMessage, dex.Message, "Wrong error message");
            });
            this.EnqueueTestComplete();
        }