public void Writing_Whole_File_In_Streamed_Blocks_Should_Create_Exact_Copy() { //use an output stream which works with buffers StreamedBlockOutputStream os = new StreamedBlockOutputStream(Token, 15000, b => UploadHandler.WriteBlockStreamed(b)); MemoryStream ms = new MemoryStream(SourceFileContents); ms.WriteTo(os); UploadHandler.CompleteTransfer(Token.TransferId); TargetFile.Refresh(); FileAssert.AreEqual(SourceFilePath, TargetFilePath); TargetFile.Delete(); InitToken(); //use a source strem using (var fs = SourceFile.OpenRead()) { fs.WriteTo(Token, SourceFile.Length, 10000, b => UploadHandler.WriteBlockStreamed(b)); UploadHandler.CompleteTransfer(Token.TransferId); TargetFile.Refresh(); FileAssert.AreEqual(SourceFilePath, TargetFilePath); } }