public async Task ShouldDecodeOneFrame() { var(decoder, writer) = GetDecoder(); await FrameProvider.WriteFrame(writer, FrameProvider.GetFrame(4)); await foreach (var frame in decoder.DecodeAsync()) { Assert.Equal(4, frame.MessageId); Assert.Equal(FrameProvider.FrameSize, frame.Payload.Memory.Length); break; } }
public async Task ShouldDecode1024Frame() { var(decoder, writer) = GetDecoder(); var enumerator = decoder.DecodeAsync().GetAsyncEnumerator(); for (var i = 0; i < 1024; i++) { await FrameProvider.WriteFrame(writer, FrameProvider.GetFrame(i)); await enumerator.MoveNextAsync(); var frame = enumerator.Current; Assert.Equal(i, frame.MessageId); Assert.Equal(FrameProvider.FrameSize, frame.Payload.Memory.Length); } }