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

TryReceive_timeout() private method

private TryReceive_timeout ( int timeout ) : void
timeout int
return void
        public void TryReceive_timeout(int timeout)
        {
            // Given
            var mb = MailboxProcessor.Start<IReplyChannel<int?>>(async inbox =>
            {
                var replyChannel = await inbox.TryReceive();
                if (replyChannel == null)
                {
                    Assert.True(false);
                    return;
                }

                var msg2 = await inbox.TryReceive(timeout);
                replyChannel.Reply(msg2 == null ? 100 : 200);
            });

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

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