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); }
public void RenameItem_HandlesType_ExpectName() { //------------Setup for test-------------------------- var renameItemService = new RenameItemService(); //------------Execute Test--------------------------- //------------Assert Results------------------------- Assert.AreEqual("RenameItemService", renameItemService.HandlesType()); }
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); }
public void RenameItem_CreateServiceEntry_ExpectProperlyFormedDynamicService() { //------------Setup for test-------------------------- var renameItem = new RenameItemService(); //------------Execute Test--------------------------- var a = renameItem.CreateServiceEntry(); //------------Assert Results------------------------- var b = a.DataListSpecification.ToString(); Assert.AreEqual("<DataList><itemToRename ColumnIODirection=\"Input\"/><newName ColumnIODirection=\"Input\"/><Dev2System.ManagmentServicePayload ColumnIODirection=\"Both\"></Dev2System.ManagmentServicePayload></DataList>", b); }
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>())); }