public ActionResult CreateAjax(CreateMindViewModel model) { var timelineUserId = this.CurrentUserSessionContext().UserId; Message message = _messageService.CreateMind(model.Mind, timelineUserId, model.Files); if (message != null) { _unitOfWork.Commit(); _userMessageService.PublishMessage(message); _messageService.ReloadMessage(message); var watcherUserId = timelineUserId; MessageViewModel messageViewModel = _messagesViewModelService.CreateMessageViewModel(message, timelineUserId, watcherUserId, true); string mindView = this.RenderRazorViewToString("_UserMessageMindPartial", messageViewModel); return(Json(new { @success = true, @view = mindView, messageId = message.Id })); } return(Json(new { @success = false, @error = "Some data are incorrect." })); }
public void message_after_publish_must_have_published_state() { Message createdMessage = _messageService.CreateMind("25e9c44f-508d-499d-b332-cb00538928d6", DatabaseHelper.UserTest1.Id); _unitOfWork.Commit(); _userMessageService.PublishMessage(createdMessage); _messageRepository.ReloadEntity(createdMessage); Assert.AreEqual(MessageStateEnum.Published, createdMessage.MessageState.MessageStateEnum, "Message after publish must have publisged state"); }