public void NonExistentValidPath_ReturnsFalse() { Assert.All((IOInputs.GetValidPathComponentNames()), (path) => { Assert.False(Exists(path), path); }); }
public void ValidPathExists_ReturnsTrue() { Assert.All((IOInputs.GetValidPathComponentNames()), (component) => { string path = Path.Combine(TestDirectory, component); DirectoryInfo testDir = Directory.CreateDirectory(path); Assert.True(Exists(path)); }); }
public void ValidPathExists_ReturnsTrue() { Assert.All((IOInputs.GetValidPathComponentNames()), (component) => { string path = Path.Combine(TestDirectory, component); FileInfo testFile = new FileInfo(path); testFile.Create().Dispose(); Assert.True(Exists(path)); }); }
public static void Exists_NonExistentValidPathAsPath_ReturnsFalse() { var paths = IOInputs.GetValidPathComponentNames(); foreach (string path in paths) { bool result = Directory.Exists(path); Assert.False(result, path); } }
public void ValidPathWithoutTrailingSlash() { DirectoryInfo testDir = Directory.CreateDirectory(GetTestFilePath()); var components = IOInputs.GetValidPathComponentNames(); Assert.All(components, (component) => { string path = testDir.FullName + Path.DirectorySeparatorChar + component; DirectoryInfo result = Create(path); Assert.Equal(path, result.FullName); Assert.True(Directory.Exists(result.FullName)); }); }
public void ValidExtendedPathWithTrailingSlash() { DirectoryInfo testDir = Directory.CreateDirectory(GetTestFilePath()); var components = IOInputs.GetValidPathComponentNames(); Assert.All(components, (component) => { string path = IOInputs.ExtendedPrefix + IOServices.AddTrailingSlashIfNeeded(Path.Combine(testDir.FullName, component)); DirectoryInfo result = Create(path); Assert.Equal(path, result.FullName); Assert.True(result.Exists); }); }
public void ValidPathWithTrailingSlash() { DirectoryInfo testDir = Directory.CreateDirectory(GetTestFilePath()); var components = IOInputs.GetValidPathComponentNames(); Assert.All(components, (component) => { string path = IOServices.AddTrailingSlashIfNeeded(component); DirectoryInfo result = new DirectoryInfo(testDir.FullName).CreateSubdirectory(path); Assert.Equal(Path.Combine(testDir.FullName, path), result.FullName); Assert.True(Directory.Exists(result.FullName)); }); }
public static void Exists_ExistentValidPathAsPath_ReturnsTrue() { var components = IOInputs.GetValidPathComponentNames(); foreach (string component in components) { using (TemporaryDirectory directory = new TemporaryDirectory()) { string path = Path.Combine(directory.Path, component); Directory.CreateDirectory(path); bool result = Directory.Exists(path); Assert.True(result, path); } } }
public static void CreateDirectory_ValidPathWithoutTrailingSlashAsPath_CanBeCreated() { using (TemporaryDirectory directory = new TemporaryDirectory()) { var components = IOInputs.GetValidPathComponentNames(); foreach (var component in components) { string path = directory.Path + Path.DirectorySeparatorChar + component; DirectoryInfo result = Directory.CreateDirectory(path); Assert.Equal(path, result.FullName); Assert.True(Directory.Exists(result.FullName)); } } }
public static void CreateDirectory_ValidPathWithTrailingSlash_CanBeCreated() { using (TemporaryDirectory directory = new TemporaryDirectory()) { var components = IOInputs.GetValidPathComponentNames(); foreach (var component in components) { string path = IOServices.AddTrailingSlashIfNeeded(Path.Combine(directory.Path, component)); DirectoryInfo result = Directory.CreateDirectory(path); Assert.Equal(path, result.FullName); Assert.True(Directory.Exists(result.FullName)); } } }