Skip to content

Commit b54d77d

Browse files
authored
Revert "MockDirectory.Move should throw when target cannot be parsed (#573)" (#574)
This reverts commit e1d605c.
1 parent e1d605c commit b54d77d

3 files changed

Lines changed: 0 additions & 86 deletions

File tree

System.IO.Abstractions.TestingHelpers.Tests/MockDirectoryTests.cs

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,69 +1903,5 @@ public void MockDirectory_SetCreationTime_ShouldNotThrowWithoutTrailingBackslash
19031903
fs.Directory.SetCreationTime(path, DateTime.Now);
19041904
fs.Directory.Delete(path);
19051905
}
1906-
1907-
[Test]
1908-
[TestCase(@"c:\temp2\fd\df")]
1909-
[TestCase(@"c:\temp2\fd\")]
1910-
[TestCase(@"c:\temp2\fd\..\fd")]
1911-
[TestCase(@"c:\temp2\fd")]
1912-
[TestCase(@".\..\temp2\fd\df")]
1913-
[TestCase(@".\..\temp2\fd\df\..")]
1914-
[TestCase(@".\..\temp2\fd\df\..\")]
1915-
[TestCase(@"..\temp2\fd\")]
1916-
[TestCase(@".\temp2\fd")]
1917-
[TestCase(@"\temp2\fd")]
1918-
[TestCase(@"temp2\fd")]
1919-
public void Move_Directory_Throws_When_Target_Directory_Without_First_Order_Path_Is_Missing(
1920-
string targetDirName)
1921-
{
1922-
// Arange
1923-
var fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>
1924-
{
1925-
{XFS.Path(@"c:\temp\exists\foldertomove"), new MockDirectoryData()}
1926-
});
1927-
1928-
string folderToMove = XFS.Path(@"c:\temp\exists\foldertomove");
1929-
targetDirName = XFS.Path(targetDirName);
1930-
1931-
// Act
1932-
Assert.Throws<DirectoryNotFoundException>(() =>
1933-
fileSystem.Directory.Move(folderToMove, targetDirName));
1934-
1935-
// Assert
1936-
Assert.IsFalse(fileSystem.Directory.Exists(targetDirName));
1937-
}
1938-
1939-
[Test]
1940-
[TestCase(@"c:\temp2\")]
1941-
[TestCase(@"c:\temp2")]
1942-
[TestCase(@"c:\temp2\..\temp2")]
1943-
[TestCase(@".\..\temp2")]
1944-
[TestCase(@".\..\temp2\..\temp2")]
1945-
[TestCase(@".\..\temp2\fd\df\..\..")]
1946-
[TestCase(@".\..\temp2\fd\df\..\..\")]
1947-
[TestCase(@"..\temp2")]
1948-
[TestCase(@".\temp2")]
1949-
[TestCase(@"\temp2")]
1950-
[TestCase(@"temp2")]
1951-
public void Move_Directory_DoesNotThrow_When_Target_Directory_With_First_Order_Path_Is_Missing(
1952-
string targetDirName)
1953-
{
1954-
// Arange
1955-
var fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>
1956-
{
1957-
{XFS.Path(@"c:\temp\exists\foldertomove"), new MockDirectoryData()}
1958-
});
1959-
1960-
string folderToMove = XFS.Path(@"c:\temp\exists\foldertomove");
1961-
targetDirName = XFS.Path(targetDirName);
1962-
1963-
// Act
1964-
Assert.DoesNotThrow(() =>
1965-
fileSystem.Directory.Move(folderToMove, targetDirName));
1966-
1967-
// Assert
1968-
Assert.IsTrue(fileSystem.Directory.Exists(targetDirName));
1969-
}
19701906
}
19711907
}

System.IO.Abstractions.TestingHelpers/MockDirectory.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -415,11 +415,6 @@ public override void Move(string sourceDirName, string destDirName)
415415
throw new DirectoryNotFoundException($"Could not find a part of the path '{sourceDirName}'.");
416416
}
417417

418-
if (!Win32FileSystemBehavior.MoveFileCanParsePath(fullDestPath))
419-
{
420-
throw new DirectoryNotFoundException($"Could not find a part of the path.");
421-
}
422-
423418
if (mockFileDataAccessor.Directory.Exists(fullDestPath) || mockFileDataAccessor.File.Exists(fullDestPath))
424419
{
425420
throw new IOException($"Cannot create '{fullDestPath}' because a file or directory with the same name already exists.");

System.IO.Abstractions.TestingHelpers/Win32FileSystemBehavior.cs

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)