Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
filipnavara committed Nov 7, 2019
1 parent 987d822 commit c6fd217
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/System.IO.FileSystem/tests/File/Copy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -331,5 +331,18 @@ public void WindowsAlternateDataStreamOverwrite(string defaultStream, string alt
Assert.Throws<IOException>(() => Copy(testFileAlternateStream, testFile2, overwrite: true));
Assert.Throws<IOException>(() => Copy(testFileAlternateStream, testFile2 + alternateStream, overwrite: true));
}

[Fact]
public void CopyOntoLockedFile()
{
string testFileSource = GetTestFilePath();
string testFileDest = GetTestFilePath();
File.Create(testFileSource).Dispose();
File.Create(testFileDest).Dispose();
using (var stream = new FileStream(testFileDest, FileMode.Open, FileAccess.Read, FileShare.None))
{
Assert.Throws<IOException>(() => Copy(testFileSource, testFileDest, overwrite: true));
}
}
}
}

0 comments on commit c6fd217

Please sign in to comment.