Beispiel #1
0
        public void TestAccessingDisposedCancellationTokenIsSafe()
        {
            var e = new ExecutorService(this.handler.Object);

            e.Dispose();


            /* Accessing the token here should not throw.
             * The tasks themselves will not execute anything as
             * should be automatically in the cancelled state. */
            e.ExecuteGet("resource", CancellationToken.None);
            e.ExecutePost("resource", CancellationToken.None);
            e.ExecuteDelete("resource", CancellationToken.None);

            this.handler.Protected()
            .Verify(SEND_ASYNC_FUNC,
                    Times.Never(),
                    ItExpr.IsAny <HttpRequestMessage>(),
                    ItExpr.IsAny <CancellationToken>());
        }