public async Task TestWriteAsync() { var buffer = new byte[(int)chained.Length]; for (int i = 0; i < buffer.Length; i++) { buffer[i] = (byte)(i & 0xff); } chained.Position = 0; await chained.WriteAsync(buffer, 0, buffer.Length); await chained.FlushAsync(); var array = backing.ToArray(); for (int i = 0; i < buffer.Length; i++) { Assert.AreEqual(buffer[i], array[i], "Written byte @ offset {0} did not match", i); } }