コード例 #1
0
        public void PropagateCancelledTask()
        {
            var js_runtime = new Mock <IJSRuntime>()
                             .Chain(m => m.Setup(js => js.InvokeAsync <string[]>(It.IsAny <string>(), It.IsAny <object[]>())).ThrowsAsync(new TaskCanceledException()))
                             .Object;
            var batching_js_runtime = new BatchingJsRuntime(js_runtime);

            Assert.ThrowsAsync <TaskCanceledException>(() => batching_js_runtime.InvokeVoidAsync("foo"));
        }
コード例 #2
0
        public void Message()
        {
            var js_runtime = new Mock <IJSRuntime>()
                             .Chain(m => m.Setup(js => js.InvokeAsync <string[]>(It.IsAny <string>(), It.IsAny <object[]>())).ReturnsAsync(new[] { "failed because of XYZ" }))
                             .Object;
            var batching_js_runtime = new BatchingJsRuntime(js_runtime);
            var exception           = Assert.ThrowsAsync <JSException>(() => batching_js_runtime.InvokeVoidAsync("foo"));

            Assert.IsTrue(exception.Message.Contains("failed because of XYZ"));
        }