[corlib] Test FileInfo.ToString after MoveTo
authorMarcos Henrich <marcos.henrich@xamarin.com>
Wed, 16 Mar 2016 10:04:40 +0000 (10:04 +0000)
committerMarcos Henrich <marcos.henrich@xamarin.com>
Wed, 16 Mar 2016 10:06:33 +0000 (10:06 +0000)
Covers #38796

mcs/class/corlib/Test/System.IO/FileInfoTest.cs

index 0068c4643b8fdcae08e5070ee5ed340ab9d64cdf..db33ec75f0febdaa5cecfef8d4ce7b4975ba9cc8 100644 (file)
@@ -880,6 +880,29 @@ namespace MonoTests.System.IO
                        }
                }
 
+               [Test] //Covers #38796
+               public void ToStringAfterMoveTo ()
+               {
+                       string name1 = "FIT.ToStringAfterMoveTo.Test";
+                       string name2 = "FIT.ToStringAfterMoveTo.Test.Alt";
+                       string path1 = TempFolder + DSC + name1;
+                       string path2 = TempFolder + DSC + name2;
+                       DeleteFile (path1);
+                       DeleteFile (path2);
+                       
+                       try {
+                               File.Create (path1).Close ();
+                               FileInfo info = new FileInfo (path1);
+                               Assert.AreEqual (path1, info.ToString (), "#A");
+
+                               info.MoveTo (path2);
+                               Assert.AreEqual (path2, info.ToString (), "#B");
+                       } finally {
+                               DeleteFile (path1);
+                               DeleteFile (path2);
+                       }
+               }
+
 #if !MOBILE
                [Test]
                public void Replace1 ()