Remove() public method

public Remove ( IContextualResourceModel resourceModel ) : void
resourceModel IContextualResourceModel
return void
        public void WorkspaceItemRepositoryRemoveWithExistingModelExpectedInvokesWrite()
        {
            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 mockResourceRepo = new Mock<IResourceRepository>();
            mockResourceRepo.Setup(resourceRepository => resourceRepository.DeleteResourceFromWorkspace(It.IsAny<IContextualResourceModel>()));
            var model = CreateModel(ResourceType.Service, mockConn, out resourceName, out workspaceID, out serverID, mockResourceRepo);

            var repositoryPath = GetUniqueRepositoryPath();
            Assert.IsFalse(File.Exists(repositoryPath));

            var repository = new WorkspaceItemRepository(repositoryPath);
            repository.AddWorkspaceItem(model.Object);
            if(File.Exists(repositoryPath))
            {
                File.Delete(repositoryPath);
            }
            repository.Remove(model.Object);
            Assert.IsTrue(File.Exists(repositoryPath));
            mockResourceRepo.Verify(resourceRepository => resourceRepository.DeleteResourceFromWorkspace(It.IsAny<IContextualResourceModel>()), Times.Once());
        }
        public void WorkspaceItemRepositoryRemoveWithNonExistingModelExpectedDoesNothing()
        {
            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);

            var repository = new WorkspaceItemRepository(GetUniqueRepositoryPath());
            repository.AddWorkspaceItem(model.Object);
            Assert.AreEqual(1, repository.WorkspaceItems.Count);

            model.Setup(m => m.ResourceName).Returns("Test_" + Guid.NewGuid());

            repository.Remove(model.Object);
            Assert.AreEqual(1, repository.WorkspaceItems.Count);
        }