public void InputStreamSink_should_work_when_read_chunks_bigger_than_stream_chunks()
{
this.AssertAllStagesStopped(() =>
{
var bytes1 = RandomByteString(10);
var bytes2 = RandomByteString(10);
var sinkProbe = CreateTestProbe();
var inputStream = Source.From(new[] { bytes1, bytes2, null }).RunWith(TestSink(sinkProbe), _materializer);
//need to wait while both elements arrive to sink
sinkProbe.ExpectMsgAllOf(GraphStageMessages.Push.Instance, GraphStageMessages.Push.Instance);
var r1 = ReadN(inputStream, 15);
r1.Item1.Should().Be(15);
r1.Item2.ShouldBeEquivalentTo(bytes1.Concat(bytes2.Take(5)));
var r2 = ReadN(inputStream, 15);
r2.Item1.Should().Be(5);
r2.Item2.ShouldBeEquivalentTo(bytes2.Drop(5));
inputStream.Close();
}, _materializer);
}