コード例 #1
0
        public void CreateAsyncFileStreamToCreateNewFile()
        {
            const string Target = @"newFile";

            using (FileUtilities.CreateAsyncFileStream(GetFullPath(Target), FileMode.CreateNew, FileAccess.Write, FileShare.Read | FileShare.Delete))
            {
                XAssert.IsTrue(File.Exists(GetFullPath(Target)));
            }
        }
コード例 #2
0
        public void CreateAsyncFileStreamToOpenExistingFle()
        {
            const string Target = @"existingFile";

            File.WriteAllText(GetFullPath(Target), "Definitely useful content");

            using (FileUtilities.CreateAsyncFileStream(GetFullPath(Target), FileMode.Open, FileAccess.Write, FileShare.Read | FileShare.Delete))
            {
                XAssert.IsTrue(File.Exists(GetFullPath(Target)));
            }
        }