Actress.Tests.MailboxProcessorTests.DefaultTimeout C# (CSharp) Method

DefaultTimeout() private method

private DefaultTimeout ( ) : void
return void
        public void DefaultTimeout()
        {
            // Given
            var mailbox = GetSimpleMailbox();

            // When
            mailbox.Start();

            Assert.Equal(Timeout.Infinite, mailbox.DefaultTimeout);

            mailbox.Post(new Reset());
            mailbox.Post(new Increment(1));

            var result = mailbox.TryPostAndReply<int?>(chan => new Fetch(chan));

            Assert.NotNull(result);
            Assert.Equal(1, result.Value);

            // Verify timeout when updating default timeout
            // We expect this to fail because of the 100ms sleep in the mailbox
            mailbox.DefaultTimeout = 10;
            mailbox.Post(new Reset());
            mailbox.Post(new Increment(1));

            result = mailbox.TryPostAndReply<int?>(chan => new Fetch(chan));
            Assert.Null(result);
        }