public async Task TestWriteAsync() { using (var stream = new ProgressStream(new DummyNetworkStream(), Update)) { var buffer = new byte[1024]; int expected = 517; progress = 0; await stream.WriteAsync(buffer, 0, expected); await stream.FlushAsync(); Assert.AreEqual(expected, progress, "progress"); } }