Repository navigation
Fix/disable tests that fail on Unix #294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -202,8 +202,11 @@ public static IEnumerable<object[]> MockDirectoryInfo_FullName_Data | |
| yield return new object[] { XFS.Path(@"c:\temp\\folder"), XFS.Path(@"c:\temp\folder") }; | ||
| yield return new object[] { XFS.Path(@"c:\temp//folder"), XFS.Path(@"c:\temp\folder") }; | ||
| yield return new object[] { XFS.Path(@"c:\temp//\\///folder"), XFS.Path(@"c:\temp\folder") }; | ||
| yield return new object[] { XFS.Path(@"\\unc\folder"), XFS.Path(@"\\unc\folder") }; | ||
| yield return new object[] { XFS.Path(@"\\unc/folder\\foo"), XFS.Path(@"\\unc\folder\foo") }; | ||
| if (!MockUnixSupport.IsUnixPlatform()) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this would be a little better if we just removed these values from the test data, and then made a new Windows test that checked just the two unc paths. This way we're testing drive paths and unc paths in two different tests. What do you think? |
||
| { | ||
| yield return new object[] { XFS.Path(@"\\unc\folder"), XFS.Path(@"\\unc\folder") }; | ||
| yield return new object[] { XFS.Path(@"\\unc/folder\\foo"), XFS.Path(@"\\unc\folder\foo") }; | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -263,8 +266,8 @@ public void MockDirectoryInfo_Constructor_ShouldThrowArgumentException_IfArgumen | |
| // Assert | ||
| var exception = Assert.Throws<ArgumentException>(action); | ||
| Assert.That(exception.Message, Does.StartWith("The path is not of a legal form.")); | ||
| } | ||
| } | ||
|
|
||
| [Test] | ||
| public void MockDirectoryInfo_ToString_ShouldReturnDirectoryName() | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -542,6 +542,11 @@ public void MockDirectory_CreMockDirectory_CreateDirectory_ShouldReturnDirectory | |
| [Test] | ||
| public void MockDirectory_CreateDirectory_ShouldWorkWithUNCPath() | ||
| { | ||
| if (MockUnixSupport.IsUnixPlatform()) | ||
| { | ||
| Assert.Inconclusive("Unix does not support ACLs."); | ||
| } | ||
|
|
||
| // Arrange | ||
| var fileSystem = new MockFileSystem(); | ||
|
|
||
|
|
@@ -555,6 +560,11 @@ public void MockDirectory_CreateDirectory_ShouldWorkWithUNCPath() | |
| [Test] | ||
| public void MockDirectory_CreateDirectory_ShouldFailIfTryingToCreateUNCPathOnlyServer() | ||
| { | ||
| if (MockUnixSupport.IsUnixPlatform()) | ||
| { | ||
| Assert.Inconclusive("Unix does not have the concept of UNC paths."); | ||
| } | ||
|
|
||
| // Arrange | ||
| var fileSystem = new MockFileSystem(); | ||
|
|
||
|
|
@@ -569,6 +579,11 @@ public void MockDirectory_CreateDirectory_ShouldFailIfTryingToCreateUNCPathOnlyS | |
| [Test] | ||
| public void MockDirectory_CreateDirectory_ShouldSucceedIfTryingToCreateUNCPathShare() | ||
| { | ||
| if (MockUnixSupport.IsUnixPlatform()) | ||
| { | ||
| Assert.Inconclusive("Unix does not have the concept of UNC paths."); | ||
| } | ||
|
|
||
| // Arrange | ||
| var fileSystem = new MockFileSystem(); | ||
|
|
||
|
|
@@ -745,11 +760,16 @@ public void MockDirectory_GetFiles_ShouldThrowAnArgumentException_IfSearchPatter | |
|
|
||
| public static IEnumerable<string> GetSearchPatternForTwoDotsExceptions() | ||
| { | ||
| yield return @"a..\b"; | ||
| yield return @"a../b"; | ||
| yield return @"../"; | ||
| yield return @"..\"; | ||
| yield return @"aaa\vv..\"; | ||
|
|
||
| if (!MockUnixSupport.IsUnixPlatform()) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a little confusing to me. If we're not on a Unix platform, go ahead and add these values to the test data.. but the comment says that these aren't a problem on Unix, so why would we exclude these? If they do need to be excluded, I would go with a similar approach as outlined above where we'd just go ahead and remove these and leverage a Windows test. |
||
| { | ||
| // These are no problem on Unix platforms | ||
| yield return @"..\"; | ||
| yield return @"aaa\vv..\"; | ||
| yield return @"a..\b"; | ||
| } | ||
| } | ||
|
|
||
| [TestCaseSource(typeof(MockDirectoryTests), "GetSearchPatternForTwoDotsExceptions")] | ||
|
|
@@ -778,7 +798,7 @@ public void MockDirectory_GetFiles_ShouldFindFilesContainingTwoOrMoreDots() | |
| }); | ||
|
|
||
| // Act | ||
| var actualResult = fileSystem.Directory.GetFiles(XFS.Path(@"c:\"), @"foo..r\*"); | ||
| var actualResult = fileSystem.Directory.GetFiles(XFS.Path(@"c:\"), XFS.Path(@"foo..r\*")); | ||
|
|
||
| // Assert | ||
| Assert.That(actualResult, Is.EquivalentTo(new [] { testPath })); | ||
|
|
@@ -790,6 +810,11 @@ public void MockDirectory_GetFiles_ShouldFindFilesContainingTwoOrMoreDots() | |
| [TestCase("aa\t")] | ||
| public void MockDirectory_GetFiles_ShouldThrowAnArgumentException_IfSearchPatternHasIllegalCharacters(string searchPattern) | ||
| { | ||
| if (MockUnixSupport.IsUnixPlatform()) | ||
| { | ||
| Assert.Inconclusive("Unix does not have this limitation."); | ||
| } | ||
|
|
||
| // Arrange | ||
| var directoryPath = XFS.Path(@"c:\Foo"); | ||
| var fileSystem = new MockFileSystem(); | ||
|
|
@@ -913,17 +938,17 @@ public void MockDirectory_GetDirectories_RelativeDirectory_WithoutChildren_Shoul | |
| public void MockDirectory_GetDirectories_RelativeDirectory_WithChildren_ShouldReturnChildDirectories(string relativeDirPath) | ||
| { | ||
| // Arrange | ||
| const string currentDirectory = @"T:\foo"; | ||
| var currentDirectory = XFS.Path(@"T:\foo"); | ||
| var fileSystem = new MockFileSystem(null, currentDirectory: currentDirectory); | ||
| fileSystem.Directory.CreateDirectory(relativeDirPath); | ||
| fileSystem.Directory.CreateDirectory(relativeDirPath + @"\child"); | ||
| fileSystem.Directory.CreateDirectory(XFS.Path(relativeDirPath)); | ||
| fileSystem.Directory.CreateDirectory(XFS.Path(relativeDirPath + @"\child")); | ||
|
|
||
| // Act | ||
| var actualResult = fileSystem.Directory.GetDirectories(relativeDirPath); | ||
| var actualResult = fileSystem.Directory.GetDirectories(XFS.Path(relativeDirPath)); | ||
|
|
||
| // Assert | ||
| CollectionAssert.AreEqual( | ||
| new[] { currentDirectory + @"\" + relativeDirPath + @"\child\" }, | ||
| new[] { XFS.Path(currentDirectory + @"\" + relativeDirPath + @"\child\") }, | ||
| actualResult | ||
| ); | ||
| } | ||
|
|
@@ -1067,28 +1092,28 @@ public void MockDirectory_EnumerateDirectories_ShouldThrowWhenPathIsNotMocked() | |
|
|
||
| public static IEnumerable<object[]> GetPathsForMoving() | ||
| { | ||
| yield return new object[] { @"a:\folder1\", @"A:\folder3\", "file.txt", @"folder2\file2.txt" }; | ||
| yield return new object[] { @"A:\folder1\", @"A:\folder3\", "file.txt", @"folder2\file2.txt" }; | ||
| yield return new object[] { @"a:\folder1\", @"a:\folder3\", "file.txt", @"folder2\file2.txt" }; | ||
| yield return new object[] { @"A:\folder1\", @"a:\folder3\", "file.txt", @"folder2\file2.txt" }; | ||
| yield return new object[] { @"A:\folder1\", @"a:\folder3\", "file.txt", @"Folder2\file2.txt" }; | ||
| yield return new object[] { @"A:\folder1\", @"a:\folder3\", "file.txt", @"Folder2\fiLe2.txt" }; | ||
| yield return new object[] { @"A:\folder1\", @"a:\folder3\", "folder444\\file.txt", @"Folder2\fiLe2.txt" }; | ||
| yield return new object[] { XFS.Path(@"a:\folder1\"), XFS.Path(@"A:\folder3\"), XFS.Path("file.txt"), XFS.Path(@"folder2\file2.txt") }; | ||
| yield return new object[] { XFS.Path(@"A:\folder1\"), XFS.Path(@"A:\folder3\"), XFS.Path("file.txt"), XFS.Path(@"folder2\file2.txt") }; | ||
| yield return new object[] { XFS.Path(@"a:\folder1\"), XFS.Path(@"a:\folder3\"), XFS.Path("file.txt"), XFS.Path(@"folder2\file2.txt") }; | ||
| yield return new object[] { XFS.Path(@"A:\folder1\"), XFS.Path(@"a:\folder3\"), XFS.Path("file.txt"), XFS.Path(@"folder2\file2.txt") }; | ||
| yield return new object[] { XFS.Path(@"A:\folder1\"), XFS.Path(@"a:\folder3\"), XFS.Path("file.txt"), XFS.Path(@"Folder2\file2.txt") }; | ||
| yield return new object[] { XFS.Path(@"A:\folder1\"), XFS.Path(@"a:\folder3\"), XFS.Path("file.txt"), XFS.Path(@"Folder2\fiLe2.txt") }; | ||
| yield return new object[] { XFS.Path(@"A:\folder1\"), XFS.Path(@"a:\folder3\"), XFS.Path("folder444\\file.txt"), XFS.Path(@"Folder2\fiLe2.txt") }; | ||
| } | ||
|
|
||
| [Test] | ||
| public void Move_DirectoryExistsWithDifferentCase_DirectorySuccessfullyMoved() | ||
| { | ||
| // Arrange | ||
| var fileSystem = new MockFileSystem(); | ||
| fileSystem.AddDirectory(@"C:\OLD_LOCATION\Data"); | ||
| fileSystem.AddFile(@"C:\old_location\Data\someFile.txt", new MockFileData("abc")); | ||
| fileSystem.AddDirectory(XFS.Path(@"C:\OLD_LOCATION\Data")); | ||
| fileSystem.AddFile(XFS.Path(@"C:\old_location\Data\someFile.txt"), new MockFileData("abc")); | ||
|
|
||
| // Act | ||
| fileSystem.Directory.Move(@"C:\old_location", @"C:\NewLocation\"); | ||
| fileSystem.Directory.Move(XFS.Path(@"C:\old_location"), XFS.Path(@"C:\NewLocation\")); | ||
|
|
||
| // Assert | ||
| Assert.IsTrue(fileSystem.File.Exists(@"C:\NewLocation\Data\someFile.txt")); | ||
| Assert.IsTrue(fileSystem.File.Exists(XFS.Path(@"C:\NewLocation\Data\someFile.txt"))); | ||
| } | ||
|
|
||
| [TestCaseSource("GetPathsForMoving")] | ||
|
|
@@ -1114,8 +1139,8 @@ public void MockDirectory_Move_ShouldMove(string sourceDirName, string destDirNa | |
| public void MockDirectory_Move_ShouldMoveDirectoryAtrributes() | ||
| { | ||
| // Arrange | ||
| const string sourceDirName = @"a:\folder1\"; | ||
| const string destDirName = @"a:\folder2\"; | ||
| var sourceDirName = XFS.Path(@"a:\folder1\"); | ||
| var destDirName = XFS.Path(@"a:\folder2\"); | ||
| const string filePathOne = "file1.txt"; | ||
| const string filePathTwo = "file2.txt"; | ||
| var fileSystem = new MockFileSystem(new Dictionary<string, MockFileData> | ||
|
|
@@ -1282,6 +1307,11 @@ public void MockDirectory_Move_ShouldThrowAnIOExceptionIfBothPathAreIdentical() | |
| [Test] | ||
| public void MockDirectory_Move_ShouldThrowAnIOExceptionIfDirectoriesAreOnDifferentVolumes() | ||
| { | ||
| if(XFS.IsUnixPlatform()) | ||
| { | ||
| Assert.Inconclusive("Unix does not have the concept of volumes"); | ||
| } | ||
|
|
||
| // Arrange | ||
| string sourcePath = XFS.Path(@"c:\a"); | ||
| string destPath = XFS.Path(@"d:\v"); | ||
|
|
@@ -1391,6 +1421,11 @@ public void MockDirectory_GetAccessControl_ShouldThrowExceptionOnDirectoryNotFou | |
| [Test] | ||
| public void MockDirectory_GetAccessControl_ShouldReturnNewDirectorySecurity() | ||
| { | ||
| if (MockUnixSupport.IsUnixPlatform()) | ||
| { | ||
| Assert.Inconclusive("Unix does not have the concept of UNC paths."); | ||
| } | ||
|
|
||
| // Arrange | ||
| var fileSystem = new MockFileSystem(); | ||
| fileSystem.Directory.CreateDirectory(XFS.Path(@"c:\foo\")); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this block of code throughout the test project, what do we think about categorizing Windows tests?
I think this would declutter the test runner a bit more (no need for inconclusives) and would also clearly show that the feature we're testing is intended for Windows.