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

TryReceivePostAndReply_with_Scan_timeout() private method

private TryReceivePostAndReply_with_Scan_timeout ( int timeout ) : void
timeout int
return void
        public void TryReceivePostAndReply_with_Scan_timeout(int timeout)
        {
            // Given
            var mb = MailboxProcessor.Start<IReplyChannel<int?>>(async inbox =>
            {
                var replyChannel = await inbox.TryReceive();
                if (replyChannel == null)
                {
                    Assert.True(false);
                    return;
                }
                try
                {
                    var _ = await inbox.Scan(__ =>
                    {
                        Assert.True(false, "Should have timedout");
                        return Task.FromResult(inbox);
                    }, timeout);
                    Assert.True(false, "should have received timeout");
                }
                catch (TimeoutException)
                {
                    replyChannel.Reply(200);
                }
            });

            // When
            var result1 = mb.PostAndReply<int?>(channel => channel);

            // Then
            Assert.Equal(200, result1);
        }