DeleteDirectory() public method

public DeleteDirectory ( string path, bool recursive = false ) : void
path string
recursive bool
return void
Esempio n. 1
0
        public void DeleteDirectoryIfPathDoesNotExist()
        {
            var root     = Path.GetTempPath();
            var path     = Path.GetRandomFileName();
            var fullPath = Path.Combine(root, path);

            var workspace = new Mock <ITfsWorkspace>();

            workspace.Setup(w => w.ItemExists(It.IsAny <string>()))
            .Returns(false);

            var target = new TfsFileSystem(workspace.Object, root);

            target.DeleteDirectory(path);

            workspace.Verify(w => w.GetPendingChanges(fullPath), Times.Once());
            workspace.Verify(w => w.PendDelete(fullPath, RecursionType.None), Times.Once());
            workspace.Verify(w => w.Undo(It.IsAny <IEnumerable <ITfsPendingChange> >()), Times.Once());
        }
Esempio n. 2
0
        public void DeleteDirectoryIfPathDoesNotExist()
        {
            var root = Path.GetTempPath();
            var path = Path.GetRandomFileName();
            var fullPath = Path.Combine(root, path);

            var workspace = new Mock<ITfsWorkspace>();

            workspace.Setup(w => w.ItemExists(It.IsAny<string>()))
                .Returns(false);

            var target = new TfsFileSystem(workspace.Object, root);

            target.DeleteDirectory(path);

            workspace.Verify(w => w.GetPendingChanges(fullPath), Times.Once());
            workspace.Verify(w => w.PendDelete(fullPath, RecursionType.None), Times.Once());
            workspace.Verify(w => w.Undo(It.IsAny<IEnumerable<ITfsPendingChange>>()), Times.Once());
        }