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

TryReceive_PostAndReply() private method

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

                msg.Reply(100);

                var msg2 = await inbox.TryReceive();
                if (msg2 == null)
                {
                    Assert.True(false);
                    return;
                }

                msg2.Reply(200);
            });

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

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