Execute() public method

public Execute ( StringBuilder>.Dictionary values, IWorkspace theWorkspace ) : StringBuilder
values StringBuilder>.Dictionary
theWorkspace IWorkspace
return StringBuilder
Beispiel #1
0
 public void RenameItem_Execute_NullValues_ErrorResult()
 {
     //------------Setup for test--------------------------
     var renameItemService = new RenameItemService();
     var serializer = new Dev2JsonSerializer();
     //------------Execute Test---------------------------
     StringBuilder jsonResult = renameItemService.Execute(null, null);
     IExplorerRepositoryResult result = serializer.Deserialize<IExplorerRepositoryResult>(jsonResult);
     //------------Assert Results-------------------------
     Assert.AreEqual(ExecStatus.Fail, result.Status);
 }
Beispiel #2
0
 public void RenameItem_Execute_ItemToRenameNotInValues_ErrorResult()
 {
     //------------Setup for test--------------------------
     var values = new Dictionary<string, StringBuilder> { { "item", new StringBuilder() } };
     var renameItemService = new RenameItemService();
     var serializer = new Dev2JsonSerializer();
     //------------Execute Test---------------------------
     StringBuilder jsonResult = renameItemService.Execute(values, null);
     IExplorerRepositoryResult result = serializer.Deserialize<IExplorerRepositoryResult>(jsonResult);
     //------------Assert Results-------------------------
     Assert.AreEqual(ExecStatus.Fail, result.Status);
 }
Beispiel #3
0
        public void RenameItem_Execute_ExpectRename()
        {
            //------------Setup for test--------------------------
            var renameItemService = new RenameItemService();

            ServerExplorerItem item = new ServerExplorerItem("a", Guid.NewGuid(), ResourceType.Folder, null, Permissions.DeployFrom, "");
            var repo = new Mock<IExplorerServerResourceRepository>();
            var ws = new Mock<IWorkspace>();
            repo.Setup(a => a.RenameItem(It.IsAny<IExplorerItem>(), It.IsAny<string>(), It.IsAny<Guid>())).Returns(new ExplorerRepositoryResult(ExecStatus.Success, "")).Verifiable();

            var serializer = new Dev2JsonSerializer();
            var inputs = new Dictionary<string, StringBuilder>
                {
                    {
                        "itemToRename", serializer.SerializeToBuilder(item)
                    },
                    {
                        "newName", new StringBuilder("bob")
                    }
                };
            ws.Setup(a => a.ID).Returns(Guid.Empty);
            renameItemService.ServerExplorerRepo = repo.Object;
            //------------Execute Test---------------------------
            renameItemService.Execute(inputs, ws.Object);
            //------------Assert Results-------------------------
            repo.Verify(a => a.RenameItem(It.IsAny<IExplorerItem>(), It.IsAny<string>(), It.IsAny<Guid>()));
        }