[PlatformSpecific(TestPlatforms.Windows)] // extended syntax with whitespace public void WindowsExtendedSyntaxWhiteSpace() { var paths = IOInputs.GetSimpleWhiteSpace(); foreach (var path in paths) { string extendedPath = Path.Combine(IOInputs.ExtendedPrefix + TestDirectory, path); Directory.CreateDirectory(extendedPath); Assert.True(Directory.Exists(extendedPath), extendedPath); } }
public void WindowsExtendedSyntaxWhiteSpace() { var paths = IOInputs.GetSimpleWhiteSpace(); using (TemporaryDirectory directory = new TemporaryDirectory()) { foreach (var path in paths) { string extendedPath = Path.Combine(IOInputs.ExtendedPrefix + directory.Path, path); Directory.CreateDirectory(extendedPath); Assert.True(Directory.Exists(extendedPath), extendedPath); } } }
public void WindowsSimpleWhiteSpace() { // CreateSubdirectory trims all simple whitespace, returning us the parent directory // that called CreateSubdirectory var components = IOInputs.GetSimpleWhiteSpace(); Assert.All(components, (component) => { string path = IOServices.RemoveTrailingSlash(GetTestFileName()); DirectoryInfo result = new DirectoryInfo(TestDirectory).CreateSubdirectory(component); Assert.True(Directory.Exists(result.FullName)); Assert.Equal(TestDirectory, 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)); }); }