Example #1
0
        public void DirectoryExistsReturnsTrueForExistingDirectory()
        {
            // Arrange
            var fs = new MockFileSystem();
            const string newdir = "newdir";
            fs.CreateDirectory(newdir);

            // Act

            // Assert
            Assert.IsTrue(fs.DirectoryExists(newdir));
        }
Example #2
0
        public void DirectoryExistsReturnsTrueForExistingDirectoryWithTrailingSlash()
        {
            // Arrange
            var fs = new MockFileSystem();
            const string newdir = "newdir";
            fs.CreateDirectory(newdir);

            // Act
            bool result = fs.DirectoryExists(newdir + "\\");

            // Assert
            Assert.IsTrue(result);
        }
Example #3
0
        public void DirectoryExistsIsCaseInsensitive()
        {
            // Arrange
            var fs = new MockFileSystem();
            fs.CreateDirectory("test\\test2");

            // Act

            // Assert
            Assert.IsTrue(fs.DirectoryExists("C:\\TEST\\test2"));
        }
Example #4
0
        public void DirectoryExistsReturnsFalseForNonexistingDirectory()
        {
            // Arrange
            var fs = new MockFileSystem();

            // Act
            bool result = fs.DirectoryExists("doesnotexist");

            // Assert
            Assert.IsFalse(result);
        }
Example #5
0
        public void DeleteDirectory_RemovesEmptyDirectory()
        {
            // Arrange
            var fs = new MockFileSystem();
            const string dirName = "c:\\test";
            fs.CreateDirectory(dirName);

            // Act
            fs.DeleteDirectory(dirName);

            // Assert
            Assert.IsFalse(fs.DirectoryExists(dirName));
        }
Example #6
0
        public void CreateSimpleDirectoryAfterInstantiate()
        {
            // Arrange
            var fs = new MockFileSystem();
            const string newdir = "newdir";

            // Act
            fs.CreateDirectory(newdir);

            // Assert
            Assert.IsTrue(fs.DirectoryExists(newdir));
        }
Example #7
0
        public void CreateNestedDirectoryFromCurrentWithTrailingSlash()
        {
            // Arrange
            var fs = new MockFileSystem();

            // Act
            fs.CreateDirectory("test\\test2\\");

            // Assert
            Assert.IsTrue(fs.DirectoryExists("c:\\test\\test2"));
        }
Example #8
0
        public void CreateDirectoryFromCurrent()
        {
            // Arrange
            var fs = new MockFileSystem();

            // Act
            fs.CreateDirectory("test");

            // Assert
            Assert.IsTrue(fs.DirectoryExists("c:\\test"));
        }
Example #9
0
        public void CreateAbsoluteDirectoryFromExistingDriveWithTrailingSlash()
        {
            // Arrange
            var fs = new MockFileSystem();

            // Act
            fs.CreateDirectory("c:\\test\\");

            // Assert
            Assert.IsTrue(fs.DirectoryExists("c:\\test"));
        }