public async Task BytesTestAsync() { MemoryStream memStream = new MemoryStream(); BigEndianStream bigEndianStream = new BigEndianStream(memStream); var testBytes = new byte[1024]; new Random().NextBytes(testBytes); await bigEndianStream.WriteAsync(testBytes); memStream.Seek(0, SeekOrigin.Begin); var result = await bigEndianStream.ReadBytesAsync(1024); for (int i = 0; i < 1024; i++) { Assert.AreEqual(testBytes[i], result[i]); } }