public void transmit_must_create_message_in_direct_observers_main_feed()
        {
            var message      = DatabaseHelper.CreateValidMessage(DatabaseHelper.UserTest4);
            var userMessage3 = DatabaseHelper.CreateValidUserMessage(message, DatabaseHelper.UserTest3);

            _messageRepository.Create(message);
            _userMessageRepository.Create(userMessage3);
            _unitOfWork.Commit();

            _userMessageService.SendTransmit(DatabaseHelper.UserTest3.Id, message.Id);

            _userMessageRepository.ReloadEntity(userMessage3);
            var numberOfAllUser2Messages  = _userMessageRepository.FindAll().Count(x => x.User.Id == DatabaseHelper.UserTest2A.Id && x.Message.Id == message.Id);
            var numberOfOtherUserMessages = _userMessageRepository.FindAll().Count(x => x.User.Id != DatabaseHelper.UserTest2A.Id && x.User.Id != DatabaseHelper.UserTest3.Id && x.Message.Id == message.Id);

            Assert.AreEqual(1, numberOfAllUser2Messages, "Message must retransmit to usertest2A feed when usertest3 retransmit");
            Assert.IsTrue(userMessage3.WasTransmitted, "Retransmitted user message must have set WasTransmitted as true");
            Assert.AreEqual(0, numberOfOtherUserMessages, "Message must not retransmit on other users feeds");
        }
Exemplo n.º 2
0
        public ActionResult Transmit(Guid messageId)
        {
            _userMessageService.SendTransmit(this.CurrentUserSessionContext().UserId, messageId);

            var message        = _messageService.FindById(messageId);
            var timelineUserId = this.CurrentUserSessionContext().UserId;
            var watcherUserId  = timelineUserId;

            MessageViewModel messageViewModel = _messagesViewModelService.CreateMessageViewModel(message, timelineUserId, watcherUserId);
            string           actionsView      = this.RenderRazorViewToString("_UserMessageActionsPartial", messageViewModel);

            return(Json(new { @success = true, @view = actionsView }));
        }