public StringBuilder Execute(Dictionary <string, StringBuilder> values, IWorkspace theWorkspace) { IExplorerRepositoryResult item; try { if (values == null) { throw new ArgumentNullException(nameof(values)); } if (theWorkspace == null) { throw new ArgumentNullException(nameof(theWorkspace)); } if (!values.TryGetValue("path", out StringBuilder path)) { throw new ArgumentException(string.Format(ErrorResource.ValueNotSupplied, "path")); } if (!values.TryGetValue("newPath", out StringBuilder newPath)) { throw new ArgumentException(string.Format(ErrorResource.ValueNotSupplied, "newPath")); } Dev2Logger.Info($"Reanme Folder. Path:{path} NewPath:{newPath}", GlobalConstants.WarewolfInfo); var explorerRepository = new ServerExplorerRepository(); item = explorerRepository.RenameFolder(path.ToString(), newPath.ToString(), theWorkspace.ID); } catch (Exception e) { Dev2Logger.Error(e, GlobalConstants.WarewolfError); item = new ExplorerRepositoryResult(ExecStatus.Fail, e.Message); } var serializer = new Dev2JsonSerializer(); return(serializer.SerializeToBuilder(item)); }
public StringBuilder Execute(Dictionary <string, StringBuilder> values, IWorkspace theWorkspace) { var serializer = new Dev2JsonSerializer(); var folderToDelete = values["folderToDelete"].ToString(); var deleteContents = bool.Parse(values["deleteContents"].ToString()); var item = ServerExplorerRepository.DeleteItem(folderToDelete, deleteContents, theWorkspace.ID); return(serializer.SerializeToBuilder(item)); }
public void ServerExplorerRepository_Load_AssertRootLevelIsFolder_ExpectFolder() { //------------Setup for test-------------------------- var serverExplorerRepository = new ServerExplorerRepository(); //------------Execute Test--------------------------- var root = serverExplorerRepository.Load(); //------------Assert Results------------------------- Assert.AreEqual(root.ExplorerItemType,ExplorerItemType.Folder); Assert.AreEqual(2,root.Children.Count ); Assert.AreEqual(root.Children.First().DisplayName,"Services"); Assert.AreEqual(root.Children[1].DisplayName,"Bobs"); }
public void ServerExplorerRepository_Load_AssertRootLevelIsFolder_ExpectFolder() { //------------Setup for test-------------------------- var serverExplorerRepository = new ServerExplorerRepository(); //------------Execute Test--------------------------- var root = serverExplorerRepository.Load(); //------------Assert Results------------------------- Assert.AreEqual(root.ExplorerItemType, ExplorerItemType.Folder); Assert.AreEqual(2, root.Children.Count); Assert.AreEqual(root.Children.First().DisplayName, "Services"); Assert.AreEqual(root.Children[1].DisplayName, "Bobs"); }