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);
}