Exemplo n.º 1
0
        public void AddMessage(AddMessageCommand command)
        {
            command.Validate();

            if (AddNotifications(command))
            {
                return;
            }

            Ticket             ticket = _ticketRepository.GetById(command.TicketId);
            LedgerIdentityUser user   = _identityResolver.GetUser();

            if (NotifyNullTicket(ticket))
            {
                return;
            }

            //User authenticity threated inside AddMessage() method
            ticket.AddMessage(command.Body, user.Id);

            if (AddNotifications(ticket))
            {
                return;
            }

            _ticketRepository.Update(ticket);

            if (Commit())
            {
                PublishLocal(new AddedTicketMessageEvent(command.Body, ticket.Id, user.Id));
            }
        }
Exemplo n.º 2
0
 public void ShouldAddMessageFromUser()
 {
     ticket.AddMessage("Olá, mundo!", user.Id);
     Assert.AreEqual(1, ticket.GetMessages().Count());
 }