public IEnumerator ChunkedStream_AppendsBytesToBuffer_FlushesToFileSystem() { string path = Path.Combine(Configuration.Instance.GetStoragePathOther(), "log_0.txt"); if (File.Exists(path)) { File.Delete(path); } ChunkedStream producer = new ChunkedStream(8, 1, functor: (AsyncRequest <object> request) => { FileProducer.Write(path, request.data as Array, false); return(AsyncRequest.Result.Completed); }); producer.Append(Encoding.ASCII.GetBytes("Test")); producer.Append(Encoding.ASCII.GetBytes("Unit")); while (!System.IO.File.Exists(path)) { yield return(null); } Assert.True(System.IO.File.ReadAllText(path) == "TestUnit"); }