UpdateWorkspaceItem() public method

public UpdateWorkspaceItem ( IContextualResourceModel resource, bool isLocalSave ) : ExecuteMessage
resource IContextualResourceModel
isLocalSave bool
return Dev2.Communication.ExecuteMessage
        public void WorkspaceItemRepositoryUpdateWorkspaceItemWithNonExistingModelExpectedDoesNothing()
        {
            string resourceName;
            Guid workspaceID;
            Guid serverID;

            var mockConn = new Mock<IEnvironmentConnection>();
            mockConn.Setup(c => c.IsConnected).Returns(true);
            ExecuteMessage msg = new ExecuteMessage();
            msg.SetMessage("");
            var payload = JsonConvert.SerializeObject(msg);
            mockConn.Setup(c => c.ExecuteCommand(It.IsAny<StringBuilder>(), It.IsAny<Guid>())).Returns(new StringBuilder(payload)).Verifiable();

            var model = CreateModel(ResourceType.Service, mockConn, out resourceName, out workspaceID, out serverID);

            var repository = new WorkspaceItemRepository(GetUniqueRepositoryPath());

            var result = repository.UpdateWorkspaceItem(model.Object, true);
            Assert.IsTrue(string.IsNullOrEmpty(result.Message.ToString()));
        }
        public void WorkspaceItemRepositoryUpdateWorkspaceItemWithExistingModelExpectedInvokesExecuteCommand()
        {
            const string ExpectedResult = "Workspace item updated";
            string resourceName;
            Guid workspaceID;
            Guid serverID;

            var mockConn = new Mock<IEnvironmentConnection>();
            mockConn.Setup(c => c.IsConnected).Returns(true);
            ExecuteMessage msg = new ExecuteMessage();
            msg.SetMessage("Workspace item updated");
            var payload = JsonConvert.SerializeObject(msg);
            mockConn.Setup(c => c.ExecuteCommand(It.IsAny<StringBuilder>(), It.IsAny<Guid>())).Returns(new StringBuilder(payload)).Verifiable();

            var model = CreateModel(ResourceType.Service, mockConn, out resourceName, out workspaceID, out serverID);

            #region Setup ImportService - GRRR!


            #endregion

            var repository = new WorkspaceItemRepository(GetUniqueRepositoryPath());
            repository.AddWorkspaceItem(model.Object);

            var result = repository.UpdateWorkspaceItem(model.Object, true);
            mockConn.Verify(c => c.ExecuteCommand(It.IsAny<StringBuilder>(), It.IsAny<Guid>()), Times.Once());
            Assert.AreEqual(ExpectedResult, result.Message.ToString());
        }
 public void WorkspaceItemRepositoryUpdateWorkspaceItemWithNullModelExpectedThrowsArgumentNullException()
 {
     var repository = new WorkspaceItemRepository(GetUniqueRepositoryPath());
     repository.UpdateWorkspaceItem(null, false);
 }