Inheritance: IEsbManagementEndpoint
コード例 #1
0
ファイル: RenameItemsTest.cs プロジェクト: Robin--/Warewolf
 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);
 }
コード例 #2
0
ファイル: RenameItemsTest.cs プロジェクト: Robin--/Warewolf
        public void RenameItem_HandlesType_ExpectName()
        {
            //------------Setup for test--------------------------
            var renameItemService = new RenameItemService();


            //------------Execute Test---------------------------

            //------------Assert Results-------------------------
            Assert.AreEqual("RenameItemService", renameItemService.HandlesType());
        }
コード例 #3
0
ファイル: RenameItemsTest.cs プロジェクト: Robin--/Warewolf
 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);
 }
コード例 #4
0
ファイル: RenameItemsTest.cs プロジェクト: Robin--/Warewolf
        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);
        }
コード例 #5
0
ファイル: RenameItemsTest.cs プロジェクト: Robin--/Warewolf
        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>()));
        }