public void DiscardWorkflow(int contentItemId, string comment, int portalId, int userId) { var item = contentController.GetContentItem(contentItemId); var workflow = GetWorkflow(item); var stateId = GetLastWorkflowStateID(workflow); AddWorkflowCommentLog(item, comment, userId); AddWorkflowLog(item, ContentWorkflowLogType.WorkflowDiscarded, userId); SetWorkflowState(stateId, item); }
public void ContentController_GetContentItem_Throws_On_Negative_ContentItemId() { // Arrange Mock <IDataService> mockDataService = new Mock <IDataService>(); ContentController controller = new ContentController(mockDataService.Object); // Act, Arrange Assert.Throws <ArgumentOutOfRangeException>(() => controller.GetContentItem(Null.NullInteger)); }
public ActionMessage GetActionMessage(StateTransaction stateTransaction, WorkflowState currentState) { ContentController contentController = new ContentController(); return(new ActionMessage { Subject = contentController.GetContentItem(stateTransaction.ContentItemId).ContentTitle + " - New Item Created", Body = "Your item has been created. Would you like to submit it for approval?" }); }
public ContentItem GetContentItem(int contentItemId) { var typeController = new ContentTypeController(); var colContentTypes = (from t in typeController.GetContentTypes() where t.ContentType == ContentTypeName select t); var cc = new ContentController(); var slide = cc.GetContentItem(contentItemId); return(slide); }
public IMenuItem GetItem(int itemId, int moduleId) { ContentItem ci = _ciCtrl.GetContentItem(itemId); if (ci != null) { return(convertContentItemtoModelItem(ci)); } else { return(null); } }
public void ContentController_GetContentItem_Calls_DataService_On_Valid_ContentItemId() { // Arrange Mock <IDataService> mockDataService = new Mock <IDataService>(); mockDataService.Setup(ds => ds.GetContentItem(Constants.CONTENT_ValidContentItemId)).Returns(MockHelper.CreateValidContentItemReader()); ContentController controller = new ContentController(mockDataService.Object); // Act ContentItem content = controller.GetContentItem(Constants.CONTENT_ValidContentItemId); // Assert mockDataService.Verify(ds => ds.GetContentItem(Constants.CONTENT_ValidContentItemId)); }
public void ContentController_GetContentItem_Returns_Null_On_InValid_ContentItemId() { // Arrange Mock <IDataService> mockDataService = new Mock <IDataService>(); mockDataService.Setup(ds => ds.GetContentItem(Constants.CONTENT_InValidContentItemId)).Returns(MockHelper.CreateEmptyContentItemReader()); ContentController controller = new ContentController(mockDataService.Object); // Act ContentItem content = controller.GetContentItem(Constants.CONTENT_InValidContentItemId); // Assert Assert.IsNull(content); }
public void ContentController_GetContentItem_Returns_ContentItem_On_Valid_ContentItemId() { // Arrange Mock <IDataService> mockDataService = new Mock <IDataService>(); mockDataService.Setup(ds => ds.GetContentItem(Constants.CONTENT_ValidContentItemId)).Returns(MockHelper.CreateValidContentItemReader()); ContentController controller = new ContentController(mockDataService.Object); // Act ContentItem content = controller.GetContentItem(Constants.CONTENT_ValidContentItemId); // Assert Assert.AreEqual(Constants.CONTENT_ValidContentItemId, content.ContentItemId); Assert.AreEqual(ContentTestHelper.GetContent(Constants.CONTENT_ValidContentItemId), content.Content); Assert.AreEqual(ContentTestHelper.GetContentKey(Constants.CONTENT_ValidContentItemId), content.ContentKey); }
public void StartWorkflow(int workflowID, int itemID, int userID) { var item = contentController.GetContentItem(itemID); var workflow = GetWorkflow(item); //If already exists a started workflow if (workflow != null && !IsWorkflowCompleted(workflow, item)) { //TODO; Study if is need to throw an exception return; } if (workflow == null) { workflow = GetWorkflowByID(workflowID); } //Delete previous logs DataProvider.Instance().DeleteContentWorkflowLogs(itemID, workflowID); var newStateID = GetFirstWorkflowStateID(workflow); SetWorkflowState(newStateID, item); AddWorkflowLog(item, ContentWorkflowLogType.WorkflowStarted, userID); AddWorkflowLog(item, ContentWorkflowLogType.StateInitiated, userID); }
public void DoActionOnStateChanged(StateTransaction stateTransaction) { // TODO: Do soemthing when the workflow has started // If this is a direct publish workflow, there should be only one state in the workflow // Automatically complete the workflow or else it stays in limbo ContentController contentController = new ContentController(); ContentItem content = contentController.GetContentItem(stateTransaction.ContentItemId); Workflow workflow = WorkflowManager.Instance.GetWorkflow(content); if (workflow.FirstState == workflow.LastState) { WorkflowController workflowController = new WorkflowController(); workflowController.CompleteState(content, "Completing direct publish workflow."); } }