public void EmptyDirectory() { // Setup var fileSystem = new TestFileSystem(); var directory = fileSystem.StageDirectory(@"\directory"); fileSystem.StageDirectory(@"\directory\child1"); fileSystem.StageDirectory(@"\directory\child2"); fileSystem.StageDirectory(@"\directory\child3"); fileSystem.StageFile(@"\directory\file1.dat"); fileSystem.StageFile(@"\directory\file2.dat"); fileSystem.StageFile(@"\directory\file3.dat"); fileSystem.StageFile(@"\directory\child2\fileA.dat"); fileSystem.StageFile(@"\directory\child2\fileB.dat"); fileSystem.StageFile(@"\directory\child2\fileC.dat"); // 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 TestFileSystem(); // Execute var results = fileSystem.DirectoryExists(a_path: null); }
public void DirectoryExistsWithBadPath() { // Setup var fileSystem = new TestFileSystem(); var path = @"X:\This is bad a directory path?"; // Execute fileSystem.DirectoryExists(path); }
public void DeleteDirectory() { // Setup var fileSystem = new TestFileSystem(); fileSystem.StageDirectory(@"x:\directory1"); fileSystem.StageDirectory(@"X:\DIRECTORY2\CHILD"); fileSystem.StageFile(@"x:\directory2\file.rgb", new TestFileInstance()); // 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 TestFileSystem(); fileSystem.StageDirectory($@"{root}directory1"); fileSystem.StageDirectory($@"{root}directory2\child"); fileSystem.StageFile($@"{root}directory2\file.rgb", new TestFileInstance()); // 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 CopyTo() { // Setup var source = new TestDirectory(_fileSystem, @"\Root\Directory\Sub1"); var dest = new TestDirectory(_fileSystem, @"\Root\Directory\SubA"); // Execute DirectoryHelpers.CopyTo(source, dest); // Assert Assert.IsTrue(_fileSystem.DirectoryExists(@"\Root\Directory\SubA")); Assert.IsTrue(_fileSystem.DirectoryExists(@"\Root\Directory\SubA\Sub2")); Assert.IsTrue(_fileSystem.FileExists(@"\Root\Directory\SubA\Sub2\File1.dat")); Assert.IsTrue(_fileSystem.FileExists(@"\Root\Directory\SubA\Sub2\File2.dat")); Assert.IsTrue(_fileSystem.DirectoryExists(@"\Root\Directory\SubA\Sub3")); Assert.IsTrue(_fileSystem.FileExists(@"\Root\Directory\SubA\Sub3\File1.dat")); Assert.IsTrue(_fileSystem.FileExists(@"\Root\Directory\SubA\Sub3\File2.dat")); Assert.IsTrue(_fileSystem.FileExists(@"\Root\Directory\SubA\File1.dat")); Assert.IsTrue(_fileSystem.FileExists(@"\Root\Directory\SubA\File2.dat")); }
public void CreateDirectory() { // Setup var fileSystem = new TestFileSystem(); var path = @"X:\This is a directory path\"; // Execute fileSystem.StageDirectory(path); // Assert Assert.IsTrue(fileSystem.DirectoryExists(path)); }
public void DirectoryExistsWithMissingEndSlash() { // Setup var fileSystem = new TestFileSystem(); fileSystem.StageDirectory(@"X:\This is a directory path\"); // Execute var results = fileSystem.DirectoryExists(@"X:\This is a directory path"); // Assert Assert.IsTrue(results); }
public void DirectoryExistsOnChildDirectory() { // Setup var fileSystem = new TestFileSystem(); fileSystem.StageDirectory(@"X:\Parent\Child"); // Execute var results = fileSystem.DirectoryExists(@"X:\Parent"); // Assert Assert.IsTrue(results); }
public void DirectoryExistsWithNotExistingDirectory() { // Setup var fileSystem = new TestFileSystem(); 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 TestFileSystem(); fileSystem.StageDirectory(@"x:\directory\this is a directory"); fileSystem.StageDirectory(@"x:\directory\this is"); // Execute fileSystem.DeleteDirectory(@"x:\directory\this is"); // Assert Assert.IsTrue(fileSystem.DirectoryExists(@"x:\directory\this is a directory")); }
public void DirectoryExists() { // Setup var fileSystem = new TestFileSystem(); var path = @"X:\This is a directory path\"; fileSystem.StageDirectory(path); // Execute path = path.ToLower(); // Ignores case. var results = fileSystem.DirectoryExists(path.ToLower()); // Assert Assert.IsTrue(results); }
public void CopyIn() { // Setup var fileSystem = new TestFileSystem(); var directory = fileSystem.StageDirectory(@"D:\directory"); var other = fileSystem.StageDirectory(@"D:\other"); // Executea var result = DirectoryHelpers.CopyIn(directory, other); // Assert Assert.IsNotNull(result); Assert.IsTrue(result.Exists); Assert.AreEqual(@"D:\directory\other", result.Path); Assert.IsTrue(fileSystem.DirectoryExists(@"D:\directory\other")); Assert.IsInstanceOfType(result, typeof(TestDirectory)); Assert.AreSame(fileSystem, (result as TestDirectory)?.FileSystem); }