예제 #1
0
        private void GracefulShutdownTimeoutWhenConnectionErrorTest0(ShutdownHint hint)
        {
            _handler = NewHandler();
            long expectedMillis = 1234;

            _handler.GracefulShutdownTimeout = TimeSpan.FromMilliseconds(expectedMillis);
            Http2Exception exception = new Http2Exception(Http2Error.ProtocolError, "Test error", hint);

            _handler.OnConnectionError(_ctx.Object, false, exception, exception);
            if (hint == ShutdownHint.GracefulShutdown)
            {
                _executor.Verify(
                    x => x.Schedule(
                        It.IsAny <Action <object> >(),
                        It.IsAny <object>(),
                        It.Is <TimeSpan>(v => v == TimeSpan.FromMilliseconds(expectedMillis))),
                    Times.AtLeastOnce());
            }
            else
            {
                _executor.Verify(
                    x => x.Schedule(
                        It.IsAny <Action <object, object> >(),
                        It.IsAny <object>(),
                        It.IsAny <object>(),
                        It.Is <TimeSpan>(v => v == TimeSpan.FromMilliseconds(expectedMillis))),
                    Times.AtLeastOnce());
            }
        }