[PlatformSpecific(PlatformID.Windows)] // Unix equivalent tested already in CreateDirectory public void WindowsWhiteSpaceAsPath_ReturnsFalse() { // Checks that errors aren't thrown when calling Exists() on impossible paths Assert.All(IOInputs.GetWhiteSpace(), (component) => { Assert.False(Exists(component)); }); }
public void WindowsWhiteSpaceAsPath_ThrowsArgumentException() { var paths = IOInputs.GetWhiteSpace(); Assert.All(paths, (path) => { Assert.Throws <ArgumentException>(() => Create(path)); }); }
public void WindowsWhitespacePath() { FileInfo testFile = new FileInfo(GetTestFilePath()); Assert.All(IOInputs.GetWhiteSpace(), (whitespace) => { Assert.Throws <ArgumentException>(() => Move(testFile.FullName, whitespace)); }); }
public void UnixWhiteSpaceAsPath_Allowed() { var paths = IOInputs.GetWhiteSpace(); Assert.All(paths, (path) => { Create(Path.Combine(TestDirectory, path)); Assert.True(Directory.Exists(Path.Combine(TestDirectory, path))); }); }
[PlatformSpecific(PlatformID.Windows)] // In Windows, trailing whitespace in a path is trimmed public void TrimTrailingWhitespacePath() { FileInfo testFile = new FileInfo(GetTestFilePath()); testFile.Create().Dispose(); Assert.All((IOInputs.GetWhiteSpace()), (component) => { Assert.True(Exists(testFile.FullName + component)); // string concat in case Path.Combine() trims whitespace before Exists gets to it }); }
public void UnixWhitespacePath() { FileInfo testFileSource = new FileInfo(GetTestFilePath()); testFileSource.Create().Dispose(); Assert.All(IOInputs.GetWhiteSpace(), (whitespace) => { Move(testFileSource.FullName, Path.Combine(TestDirectory, whitespace)); Move(Path.Combine(TestDirectory, whitespace), testFileSource.FullName); }); }
public void UnixNonSignificantTrailingWhiteSpace() { // Unix treats trailing/prename whitespace as significant and a part of the name. DirectoryInfo testDir = Create(GetTestFilePath()); var components = IOInputs.GetWhiteSpace(); Assert.All(components, (component) => { string path = IOServices.RemoveTrailingSlash(testDir.FullName) + component; DirectoryInfo result = Create(path); Assert.True(Directory.Exists(result.FullName)); Assert.NotEqual(testDir.FullName, IOServices.RemoveTrailingSlash(result.FullName)); }); }
public void WindowsTrailingWhiteSpace() { // Windows will remove all nonsignificant whitespace in a path DirectoryInfo testDir = Create(GetTestFilePath()); var components = IOInputs.GetWhiteSpace(); Assert.All(components, (component) => { string path = IOServices.RemoveTrailingSlash(testDir.FullName) + component; DirectoryInfo result = Create(path); Assert.True(Directory.Exists(result.FullName)); Assert.Equal(testDir.FullName, IOServices.RemoveTrailingSlash(result.FullName)); }); }
[PlatformSpecific(PlatformID.Windows)] // In Windows, trailing whitespace in a path is trimmed appropriately public void TrailingWhitespaceExistence() { DirectoryInfo testDir = Directory.CreateDirectory(GetTestFilePath()); Assert.All(IOInputs.GetWhiteSpace(), (component) => { string path = testDir.FullName + component; Assert.True(Exists(path), path); // string concat in case Path.Combine() trims whitespace before Exists gets to it Assert.False(Exists(IOInputs.ExtendedPrefix + path), path); }); Assert.All(IOInputs.GetSimpleWhiteSpace(), (component) => { string path = GetTestFilePath(memberName: "Extended") + component; testDir = Directory.CreateDirectory(IOInputs.ExtendedPrefix + path); Assert.False(Exists(path), path); Assert.True(Exists(testDir.FullName)); }); }