Execute() public méthode

public Execute ( StringBuilder>.Dictionary values, IWorkspace theWorkspace ) : StringBuilder
values StringBuilder>.Dictionary
theWorkspace IWorkspace
Résultat StringBuilder
Exemple #1
0
 public void DeleteItem_Execute_NullValues_ErrorResult()
 {
     //------------Setup for test--------------------------
     var deleteItem = new DeleteItemService();
     var serializer = new Dev2JsonSerializer();
     //------------Execute Test---------------------------
     StringBuilder jsonResult = deleteItem.Execute(null, null);
     IExplorerRepositoryResult result = serializer.Deserialize<IExplorerRepositoryResult>(jsonResult);
     //------------Assert Results-------------------------
     Assert.AreEqual(ExecStatus.Fail, result.Status);
 }
Exemple #2
0
 public void DeleteItem_Execute_ItemToDeleteNotInValues_ErrorResult()
 {
     //------------Setup for test--------------------------
     var values = new Dictionary<string, StringBuilder> { { "item", new StringBuilder() } };
     var deleteItem = new DeleteItemService();
     var serializer = new Dev2JsonSerializer();
     //------------Execute Test---------------------------
     StringBuilder jsonResult = deleteItem.Execute(values, null);
     IExplorerRepositoryResult result = serializer.Deserialize<IExplorerRepositoryResult>(jsonResult);
     //------------Assert Results-------------------------
     Assert.AreEqual(ExecStatus.Fail, result.Status);
 }
Exemple #3
0
        public void DeleteItem_Execute_ExpectName()
        {
            //------------Setup for test--------------------------
            var deleteItem = new DeleteItemService();

            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.DeleteItem(It.IsAny<IExplorerItem>(), It.IsAny<Guid>())).Returns(new ExplorerRepositoryResult(ExecStatus.Success, "")).Verifiable();

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