Пример #1
0
        public void CanUpdateWorkItemWithCommitActionLocalSaveOnly()
        {
            //Lock because of access to resourcatalog
            lock (SyncRoot)
            {
                XElement testWorkspaceItemXml = XmlResource.Fetch("WorkspaceItem");

                Guid workspaceID;
                var  repositoryInstance = SetupRepo(out workspaceID);

                var workspace = repositoryInstance.Get(workspaceID);

                IEsbManagementEndpoint             endpoint = new UpdateWorkspaceItem();
                Dictionary <string, StringBuilder> data     = new Dictionary <string, StringBuilder>();
                data["ItemXml"]     = new StringBuilder(testWorkspaceItemXml.ToString().Replace("WorkspaceID=\"B1890C86-95D8-4612-A7C3-953250ED237A\"", "WorkspaceID=\"" + workspaceID + "\""));
                data["IsLocalSave"] = new StringBuilder("true");

                // Now remove the
                ResourceCatalog.Instance.DeleteResource(GlobalConstants.ServerWorkspaceID, _serviceID, "WorkflowService", "Domain Admins,Domain Users,Windows SBS Remote Web Workplace Users,Windows SBS Fax Users,Windows SBS Folder Redirection Accounts,All Users,Windows SBS SharePoint_MembersGroup,Windows SBS Link Users,Company Users,Business Design Studio Developers,Test Engineers,DEV2 Limited Internet Access");

                endpoint.Execute(data, workspace);

                var res = ResourceCatalog.Instance.GetResource(GlobalConstants.ServerWorkspaceID, _serviceID);

                Assert.IsNull(res);
            }
        }
Пример #2
0
        public void CanUpdateWorkItemWithCommitActionLocalSaveOnly()
        {
            //Lock because of access to resourcatalog
            lock (SyncRoot)
            {
                XElement testWorkspaceItemXml = XmlResource.Fetch("WorkspaceItem");

                Guid workspaceID;
                var  repositoryInstance = SetupRepo(out workspaceID);

                var workspace = repositoryInstance.Get(workspaceID);

                IEsbManagementEndpoint             endpoint = new UpdateWorkspaceItem();
                Dictionary <string, StringBuilder> data     = new Dictionary <string, StringBuilder>();
                data["ItemXml"]     = new StringBuilder(testWorkspaceItemXml.ToString().Replace("WorkspaceID=\"B1890C86-95D8-4612-A7C3-953250ED237A\"", "WorkspaceID=\"" + workspaceID + "\""));
                data["IsLocalSave"] = new StringBuilder("true");

                // Now remove the
                ResourceCatalog.Instance.DeleteResource(GlobalConstants.ServerWorkspaceID, _serviceID, "WorkflowService");

                endpoint.Execute(data, workspace);

                var res = ResourceCatalog.Instance.GetResource(GlobalConstants.ServerWorkspaceID, _serviceID);

                Assert.IsNull(res);
            }
        }
Пример #3
0
        public void UpdateWorkspaceItemWithValidItemXml()
        {
            var workspaceItem = new WorkspaceItem(TestWorkspaceItemXml);

            var workspace = new Mock <IWorkspace>();

            workspace.Setup(m => m.ID).Returns(TestWorkspaceID);
            workspace.Setup(m => m.Update(It.Is <IWorkspaceItem>(i => i.Equals(workspaceItem)), It.IsAny <bool>(), It.IsAny <string>())).Verifiable();

            IEsbManagementEndpoint             endpoint = new UpdateWorkspaceItem();
            Dictionary <string, StringBuilder> data     = new Dictionary <string, StringBuilder>();

            data["ItemXml"] = new StringBuilder(TestWorkspaceItemXml.ToString());

            endpoint.Execute(data, workspace.Object);

            workspace.Verify(m => m.Update(It.Is <IWorkspaceItem>(i => i.Equals(workspaceItem)), It.IsAny <bool>(), It.IsAny <string>()), Times.Exactly(1));
        }
Пример #4
0
        public void UpdateWorkspaceItemWithInvalidItemXml()
        {
            var workspace = new Mock <IWorkspace>();

            workspace.Setup(m => m.ID).Returns(TestWorkspaceID);

            IEsbManagementEndpoint             endpoint = new UpdateWorkspaceItem();
            Dictionary <string, StringBuilder> data     = new Dictionary <string, StringBuilder>();

            data["ItemXml"] = new StringBuilder("<xxxx/>");
            data["Roles"]   = null;

            var result = endpoint.Execute(data, workspace.Object);

            var obj = ConvertToMsg(result.ToString());

            Assert.IsTrue(obj.Message.Contains("Error updating workspace item"));
            Assert.IsTrue(obj.HasError);
        }
Пример #5
0
        public void UpdateWorkspaceItemWithItemXmlFromAnotherWorkspace()
        {
            var workspace = new Mock <IWorkspace>();

            workspace.Setup(m => m.ID).Returns(TestWorkspaceID);

            var workspaceItem = new WorkspaceItem(Guid.NewGuid(), Guid.NewGuid(), Guid.Empty, Guid.Empty);
            var itemXml       = workspaceItem.ToXml().ToString();

            IEsbManagementEndpoint             endpoint = new UpdateWorkspaceItem();
            Dictionary <string, StringBuilder> data     = new Dictionary <string, StringBuilder>();

            data["ItemXml"] = new StringBuilder(itemXml);
            data["Roles"]   = new StringBuilder();

            var result = endpoint.Execute(data, workspace.Object);

            var obj = ConvertToMsg(result.ToString());

            Assert.IsTrue(obj.Message.Contains("Cannot update a workspace item from another workspace"));
            Assert.IsTrue(obj.HasError);
        }