Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Christoforides <alexis@thenull.net>2018-11-14 22:15:38 +0300
committerAlexis Christoforides <alexis@thenull.net>2018-11-15 01:44:30 +0300
commit11a204192ab02b20bc7876c0979157a698c52df3 (patch)
tree57058aa43418628fb53c8857f1743b5d774de208 /src/System.IO.FileSystem/tests
parent59758400370a775c5d0474cc0d8d8063d2eea216 (diff)
Re-initialize DirectoryInfo.Name after a MoveTo() operation
Fixes https://github.com/dotnet/corefx/issues/33490
Diffstat (limited to 'src/System.IO.FileSystem/tests')
-rw-r--r--src/System.IO.FileSystem/tests/DirectoryInfo/MoveTo.cs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/System.IO.FileSystem/tests/DirectoryInfo/MoveTo.cs b/src/System.IO.FileSystem/tests/DirectoryInfo/MoveTo.cs
index 264e63224f..12393b0e6c 100644
--- a/src/System.IO.FileSystem/tests/DirectoryInfo/MoveTo.cs
+++ b/src/System.IO.FileSystem/tests/DirectoryInfo/MoveTo.cs
@@ -28,19 +28,23 @@ namespace System.IO.Tests
public void DirectoryPathUpdatesOnMove()
{
//NOTE: MoveTo adds a trailing separator character to the FullName of a DirectoryInfo
+ string DestName1 = GetTestFileName();
+ string DestName2 = GetTestFileName();
string testDirSource = Path.Combine(TestDirectory, GetTestFileName());
- string testDirDest1 = Path.Combine(TestDirectory, GetTestFileName());
- string testDirDest2 = Path.Combine(TestDirectory, GetTestFileName());
+ string testDirDest1 = Path.Combine(TestDirectory, DestName1);
+ string testDirDest2 = Path.Combine(TestDirectory, DestName2);
DirectoryInfo sourceDir = Directory.CreateDirectory(testDirSource);
Move(sourceDir, testDirDest1);
Assert.True(Directory.Exists(testDirDest1));
Assert.False(Directory.Exists(testDirSource));
Assert.Equal(testDirDest1 + Path.DirectorySeparatorChar, sourceDir.FullName);
+ Assert.Equal(DestName1, sourceDir.Name);
Move(sourceDir, testDirDest2);
Assert.True(Directory.Exists(testDirDest2));
Assert.Equal(testDirDest2 + Path.DirectorySeparatorChar, sourceDir.FullName);
+ Assert.Equal(DestName2, sourceDir.Name);
}
#endregion