public async Task SendAsync_Uses_Child_Output_Channel_For_Sending() { var outputChannel = A.Fake<IAsyncOutputChannel<string>>(); string expectedOutput = "Hi words"; var channel = new AsyncDuplexChannel<string>(A.Fake<IAsyncInputChannel<string>>(), outputChannel); await channel.SendAsync(expectedOutput); A.CallTo(() => outputChannel.SendAsync(expectedOutput)).MustHaveHappened(); }
public async Task ReceiveAsync_Uses_Child_Input_Channel_For_Receiving() { var inputChannel = A.Fake<IAsyncInputChannel<string>>(); string expectedInput = "Hello pals"; A.CallTo(() => inputChannel.ReceiveAsync()).Returns(expectedInput); var channel = new AsyncDuplexChannel<string>(inputChannel, A.Fake<IAsyncOutputChannel<string>>()); string actualInput = await channel.ReceiveAsync(); Assert.That(actualInput, Is.EqualTo(expectedInput)); }