public void FFSFollowingRead(bool async)
        {
            {
                using var input       = File.CreateText(this.inputFilePath);
                using var ffs         = new FollowingFileStream(this.inputFilePath, 4 * 1024, async);
                using var destination = File.CreateText(this.outputFilePath);
                ffs.ReadTimeout       = 400;
                destination.AutoFlush = true;
                var os   = destination.BaseStream;
                var copy = ffs.CopyToAsync(os);
                Assert.AreEqual(0, os.Length);
                Thread.Sleep(ffs.ReadTimeout / 2);
                Assert.IsFalse(copy.IsCompleted);
                input.WriteLine("coucou2");
                input.Close();
                Assert.IsTrue(copy.Wait(3 * ffs.ReadTimeout));
            }

            Assert.IsTrue(FileCompare(this.inputFilePath, this.outputFilePath));
        }
Пример #2
0
 private static async Task CopyToOutput()
 {
     using var source      = new FollowingFileStream(InputPath);
     using var destination = new FileStream(OutputPath, FileMode.Create, FileAccess.Write, FileShare.Read);
     await source.CopyToAsync(destination).ConfigureAwait(false);
 }