* FileTest.cs: New test for File.Copy throwing an exception if src and
dest are the same.
svn path=/trunk/mcs/; revision=147180
+2009-12-01 Carlos Alberto Cortez <calberto.cortez@gmail.com>
+
+ * FileTest.cs: New test for File.Copy throwing an exception if src and
+ dest are the same.
+
2009-10-15 Sebastien Pouliot <sebastien@ximian.com>
* UnmanagedMemoryStreamTest.cs: Add more test cases to cover all
}
}
+ [Test]
+ public void Copy_SourceFileName_DestFileName_Same ()
+ {
+ string source = TempFolder + Path.DirectorySeparatorChar + "SameFile.txt";
+ DeleteFile (source);
+ try {
+ // new empty file
+ File.Create (source).Close ();
+ try {
+ File.Copy (source, source, true);
+ Assert.Fail ("#1");
+ } catch (IOException ex) {
+ // process cannot access file ... because it is being used by another process
+ Assert.IsNull (ex.InnerException, "#2");
+ Assert.IsTrue (ex.Message.IndexOf (source) != -1, "#3");
+ }
+ } finally {
+ DeleteFile (source);
+ }
+ }
+
[Test]
public void Copy ()
{