public async Task WriteToStreamAsync() { var bnumber = new BNumber(1234); var ms = new MemoryStream(); await bnumber.EncodeToAsync(ms); var result = Encoding.UTF8.GetString(ms.ToArray()); result.Should().Be("i1234e"); }
public async Task WriteToPipeWriterAsync() { var bnumber = new BNumber(1234); var(reader, writer) = new Pipe(); await bnumber.EncodeToAsync(writer); reader.TryRead(out var readResult); var result = Encoding.UTF8.GetString(readResult.Buffer.First.Span.ToArray()); result.Should().Be("i1234e"); }