public void EmptyDirectory() { // Setup var fileSystem = new PathTree <string>(); var directory = fileSystem.CreateDirectory(@"\directory"); fileSystem.CreateDirectory(@"\directory\child1"); fileSystem.CreateDirectory(@"\directory\child2"); fileSystem.CreateDirectory(@"\directory\child3"); fileSystem.CreateFile(@"\directory\file1.dat", "Value1"); fileSystem.CreateFile(@"\directory\file2.dat", "Value2"); fileSystem.CreateFile(@"\directory\file3.dat", "Value3"); fileSystem.CreateFile(@"\directory\child2\fileA.dat", "ValueA"); fileSystem.CreateFile(@"\directory\child2\fileB.dat", "ValueB"); fileSystem.CreateFile(@"\directory\child2\fileC.dat", "ValueC"); // Execute directory.Empty(); // Assert Assert.IsTrue(fileSystem.DirectoryExists(@"\directory")); Assert.IsFalse(fileSystem.DirectoryExists(@"\directory\child1")); Assert.IsFalse(fileSystem.DirectoryExists(@"\directory\child2")); Assert.IsFalse(fileSystem.DirectoryExists(@"\directory\child3")); Assert.IsFalse(fileSystem.FileExists(@"\directory\file1.dat")); Assert.IsFalse(fileSystem.FileExists(@"\directory\file2.dat")); Assert.IsFalse(fileSystem.FileExists(@"\directory\file3.dat")); Assert.IsFalse(fileSystem.FileExists(@"\directory\child2\fileA.dat")); Assert.IsFalse(fileSystem.FileExists(@"\directory\child2\fileB.dat")); Assert.IsFalse(fileSystem.FileExists(@"\directory\child2\fileC.dat")); }
public void DirectoryExistsWithNull() { // Setup var fileSystem = new PathTree <string>(); // Execute var results = fileSystem.DirectoryExists(a_path: null); }
public void DeleteDirectory() { // Setup var fileSystem = new PathTree <string>(); fileSystem.CreateDirectory(@"x:\directory1"); fileSystem.CreateDirectory(@"X:\DIRECTORY2\CHILD"); fileSystem.CreateFile(@"x:\directory2\file.rgb", "Value"); // Execute fileSystem.DeleteDirectory(@"x:\directory2"); // Assert Assert.IsTrue(fileSystem.DirectoryExists(@"x:\directory1")); Assert.IsFalse(fileSystem.DirectoryExists((@"x:\directory2"))); Assert.IsFalse(fileSystem.DirectoryExists(@"x:\directory2\child")); Assert.IsFalse(fileSystem.FileExists(@"x:\directory2\file.rgb")); }
public void DeleteNotExistingDirectory() { // Setup var root = Path.GetPathRoot(Environment.SystemDirectory); var fileSystem = new PathTree <string>(); fileSystem.CreateDirectory($@"{root}directory1"); fileSystem.CreateDirectory($@"{root}directory2\child"); fileSystem.CreateFile($@"{root}directory2\file.rgb", "Value"); // Execute fileSystem.DeleteDirectory(@"\directory3"); // Assert Assert.IsTrue(fileSystem.DirectoryExists($@"{root}directory1")); Assert.IsTrue(fileSystem.DirectoryExists(($@"{root}directory2"))); Assert.IsTrue(fileSystem.DirectoryExists($@"{root}directory2\child")); Assert.IsTrue(fileSystem.FileExists($@"{root}directory2\file.rgb")); }
public void CreateDirectory() { // Setup var fileSystem = new PathTree<string>(); var path = @"X:\This is a directory path\"; // Execute fileSystem.CreateDirectory(path); // Assert Assert.IsTrue(fileSystem.DirectoryExists(path)); }
public void CreateDirectory() { // Setup var fileSystem = new PathTree <string>(); var path = @"X:\This is a directory path\"; // Execute fileSystem.CreateDirectory(path); // Assert Assert.IsTrue(fileSystem.DirectoryExists(path)); }
public void DirectoryExistsOnChildDirectory() { // Setup var fileSystem = new PathTree <string>(); fileSystem.CreateDirectory(@"X:\Parent\Child"); // Execute var results = fileSystem.DirectoryExists(@"X:\Parent"); // Assert Assert.IsTrue(results); }
public void DirectoryExistsWithMissingEndSlash() { // Setup var fileSystem = new PathTree <string>(); fileSystem.CreateDirectory(@"X:\This is a directory path\"); // Execute var results = fileSystem.DirectoryExists(@"X:\This is a directory path"); // Assert Assert.IsTrue(results); }
public void DirectoryExistsWithNotExistingDirectory() { // Setup var fileSystem = new PathTree <string>(); var path = @"X:\This is a directory path\"; // Execute path = path.ToLower(); // Ignores case. var results = fileSystem.DirectoryExists(path.ToLower()); // Assert Assert.IsFalse(results); }
public void DeleteDirectoryWithPartialName() { // Setup var fileSystem = new PathTree <string>(); fileSystem.CreateDirectory(@"x:\directory\this is a directory"); fileSystem.CreateDirectory(@"x:\directory\this is"); // Execute fileSystem.DeleteDirectory(@"x:\directory\this is"); // Assert Assert.IsTrue(fileSystem.DirectoryExists(@"x:\directory\this is a directory")); }
public void DeleteDirectory() { // Setup var fileSystem = new PathTree<string>(); fileSystem.CreateDirectory(@"x:\directory1"); fileSystem.CreateDirectory(@"X:\DIRECTORY2\CHILD"); fileSystem.CreateFile(@"x:\directory2\file.rgb", "Value"); // Execute fileSystem.DeleteDirectory(@"x:\directory2"); // Assert Assert.IsTrue(fileSystem.DirectoryExists(@"x:\directory1")); Assert.IsFalse(fileSystem.DirectoryExists((@"x:\directory2"))); Assert.IsFalse(fileSystem.DirectoryExists(@"x:\directory2\child")); Assert.IsFalse(fileSystem.FileExists(@"x:\directory2\file.rgb")); }
public void DeleteNotExistingDirectory() { // Setup var root = Path.GetPathRoot(Environment.SystemDirectory); var fileSystem = new PathTree<string>(); fileSystem.CreateDirectory($@"{root}directory1"); fileSystem.CreateDirectory($@"{root}directory2\child"); fileSystem.CreateFile($@"{root}directory2\file.rgb", "Value"); // Execute fileSystem.DeleteDirectory(@"\directory3"); // Assert Assert.IsTrue(fileSystem.DirectoryExists($@"{root}directory1")); Assert.IsTrue(fileSystem.DirectoryExists(($@"{root}directory2"))); Assert.IsTrue(fileSystem.DirectoryExists($@"{root}directory2\child")); Assert.IsTrue(fileSystem.FileExists($@"{root}directory2\file.rgb")); }
public void DirectoryExistsOnChildDirectory() { // Setup var fileSystem = new PathTree<string>(); fileSystem.CreateDirectory(@"X:\Parent\Child"); // Execute var results = fileSystem.DirectoryExists(@"X:\Parent"); // Assert Assert.IsTrue(results); }
public void DirectoryExistsWithMissingEndSlash() { // Setup var fileSystem = new PathTree<string>(); fileSystem.CreateDirectory(@"X:\This is a directory path\"); // Execute var results = fileSystem.DirectoryExists(@"X:\This is a directory path"); // Assert Assert.IsTrue(results); }
public void DirectoryExistsWithNotExistingDirectory() { // Setup var fileSystem = new PathTree<string>(); var path = @"X:\This is a directory path\"; // Execute path = path.ToLower(); // Ignores case. var results = fileSystem.DirectoryExists(path.ToLower()); // Assert Assert.IsFalse(results); }
public void DeleteDirectoryWithPartialName() { // Setup var fileSystem = new PathTree<string>(); fileSystem.CreateDirectory(@"x:\directory\this is a directory"); fileSystem.CreateDirectory(@"x:\directory\this is"); // Execute fileSystem.DeleteDirectory(@"x:\directory\this is"); // Assert Assert.IsTrue(fileSystem.DirectoryExists(@"x:\directory\this is a directory")); }
public void EmptyDirectory() { // Setup var fileSystem = new PathTree<string>(); var directory = fileSystem.CreateDirectory(@"\directory"); fileSystem.CreateDirectory(@"\directory\child1"); fileSystem.CreateDirectory(@"\directory\child2"); fileSystem.CreateDirectory(@"\directory\child3"); fileSystem.CreateFile(@"\directory\file1.dat", "Value1"); fileSystem.CreateFile(@"\directory\file2.dat", "Value2"); fileSystem.CreateFile(@"\directory\file3.dat", "Value3"); fileSystem.CreateFile(@"\directory\child2\fileA.dat", "ValueA"); fileSystem.CreateFile(@"\directory\child2\fileB.dat", "ValueB"); fileSystem.CreateFile(@"\directory\child2\fileC.dat", "ValueC"); // Execute directory.Empty(); // Assert Assert.IsTrue(fileSystem.DirectoryExists(@"\directory")); Assert.IsFalse(fileSystem.DirectoryExists(@"\directory\child1")); Assert.IsFalse(fileSystem.DirectoryExists(@"\directory\child2")); Assert.IsFalse(fileSystem.DirectoryExists(@"\directory\child3")); Assert.IsFalse(fileSystem.FileExists(@"\directory\file1.dat")); Assert.IsFalse(fileSystem.FileExists(@"\directory\file2.dat")); Assert.IsFalse(fileSystem.FileExists(@"\directory\file3.dat")); Assert.IsFalse(fileSystem.FileExists(@"\directory\child2\fileA.dat")); Assert.IsFalse(fileSystem.FileExists(@"\directory\child2\fileB.dat")); Assert.IsFalse(fileSystem.FileExists(@"\directory\child2\fileC.dat")); }
public void DirectoryExistsWithNull() { // Setup var fileSystem = new PathTree<string>(); // Execute var results = fileSystem.DirectoryExists(a_path: null); }