コード例 #1
0
        public void EchoGrain_EchoError()
        {
            grain = GrainClient.GrainFactory.GetGrain<IEchoTaskGrain>(Guid.NewGuid());
        
            Task<string> promise = grain.EchoErrorAsync(expectedEchoError);
            bool ok = promise.ContinueWith(t =>
            {
                if (!t.IsFaulted) Assert.Fail("EchoError should not have completed successfully");

                Exception exc = t.Exception;
                while (exc is AggregateException) exc = exc.InnerException;
                string received = exc.Message;
                Assert.AreEqual(expectedEchoError, received);
            }).Wait(timeout);
            Assert.IsTrue(ok, "Finished OK");
        }
コード例 #2
0
        public async Task EchoGrain_EchoError()
        {
            grain = this.GrainFactory.GetGrain <IEchoTaskGrain>(Guid.NewGuid());

            Task <string> promise = grain.EchoErrorAsync(expectedEchoError);
            await promise.ContinueWith(t =>
            {
                if (!t.IsFaulted)
                {
                    Assert.True(false);               // EchoError should not have completed successfully
                }
                Exception exc = t.Exception;
                while (exc is AggregateException)
                {
                    exc = exc.InnerException;
                }
                string received = exc.Message;
                Assert.Equal(expectedEchoError, received);
            }).WithTimeout(timeout);
        }
コード例 #3
0
        public void EchoGrain_EchoError()
        {
            grain = GrainClient.GrainFactory.GetGrain <IEchoTaskGrain>(Guid.NewGuid());

            Task <string> promise = grain.EchoErrorAsync(expectedEchoError);
            bool          ok      = promise.ContinueWith(t =>
            {
                if (!t.IsFaulted)
                {
                    Assert.Fail("EchoError should not have completed successfully");
                }

                Exception exc = t.Exception;
                while (exc is AggregateException)
                {
                    exc = exc.InnerException;
                }
                string received = exc.Message;
                Assert.AreEqual(expectedEchoError, received);
            }).Wait(timeout);

            Assert.IsTrue(ok, "Finished OK");
        }