Exemplo n.º 1
0
        public Task Rename(Guid id, string newName)
        {
            var node = _libraryView.Get(id);

            if (node is LibraryFileNode)
            {
                return(Task.Factory.StartNew(() =>
                {
                    _library.Rename(id, newName);
                    node.Name = newName;
                }));
            }

            var allChildren = _libraryView.GetAllChildren(id).ToList();

            return(Task.Factory.StartNew(() =>
            {
                node.Name = newName;
                foreach (var libraryViewNode in allChildren)
                {
                    var path = GetPath(libraryViewNode.Parent);
                    _library.MoveFile(libraryViewNode.Id, path, libraryViewNode.Name);
                }
            }));
        }
Exemplo n.º 2
0
        public void MoveCanAlsoRename()
        {
            var item    = _ops.AddFile(_data, "test", new[] { "new" }, _time, @"the\test\path");
            var nameTag = item.NameTag;

            Reload();
            _ops.MoveFile(item.Id, new [] { "some", "new", "location" }, "renamed");
            Reload();
            Assert.That(_ops.Binaries.First(b => b.Id == item.Id).NameTag, Is.GreaterThan(nameTag));
        }