public void DomainTest_ForwardMessage()
 {
     ISendMessageService sendMessageService = new SendSiteMessageService();
     Message readMessage = new Message("title", "content ", new Sender("sender"), new Recipient("recipient"));
     Contact recipient = new Sender("recipient");
     Message relayMessage = new Message("title", "content ", readMessage.Recipient, recipient);
     Assert.True(sendMessageService.SendMessage(relayMessage));
 }
 public OperationResponse ForwardMessage(string messageId, string title, string content, string senderLoginName, string receiverDisplayName)
 {
     Contact sender = contactRepository.GetContactByLoginName(senderLoginName);
     if (sender == null)
     {
         return OperationResponse.Error("未获取到发件人信息");
     }
     Contact receiver = contactRepository.GetContactByDisplayName(receiverDisplayName);
     if (receiver == null)
     {
         return OperationResponse.Error("未获取到收件人信息");
     }
     Message message = new Message(title, content, sender, receiver);
     if (sendMessageService.SendMessage(message))
     {
         messageRepository.AddMessage(message);
         return OperationResponse.Success("转发成功");
         //return Context.Commit();
     }
     else
     {
         return OperationResponse.Error("转发失败");
     }
 }
 public void DomainTest_ReadMessageRecipient()
 {
     Contact recipient = new Recipient("recipient");
     Message message = new Message("title", "content", new Sender("sender"), recipient);
     message.SetState(recipient);
     Console.WriteLine("Title:" + message.Title);
     Console.WriteLine("Content:" + message.Content);
     Console.WriteLine("Sender:" + message.Sender.Name);
     Console.WriteLine("Recipient:" + message.Recipient.Name);
     Console.WriteLine("MessageState:" + (message.State == MessageState.Unread ? "未读" : "已读"));
 }
 public void DomainTest_SendShortMessage()
 {
     ISendMessageService sendMessageService = new SendSiteMessageService();
     Contact sender = new Sender("sender");
     Contact recipient = new Recipient("recipient");
     Message message = new Message("title", "content ", sender, recipient);
     Assert.True(sendMessageService.SendMessage(message));
 }
 public void DomainTest_ReplyMessage()
 {
     ISendMessageService sendMessageService = new SendSiteMessageService();
     Message readMessage = new Message("title", "content ", new Sender("sender"), new Recipient("recipient"));
     Contact reply = readMessage.Recipient;
     Message replyMessage = new Message("title", readMessage.Title + "content ", reply, readMessage.Sender);
     Assert.True(sendMessageService.SendMessage(replyMessage));
 }
 public OperationResponse ReplyMessage(string messageId, string title, string content, string replierLoginName)
 {
     Message replyMessage = messageRepository.GetMessageById(messageId);
     if (replyMessage == null)
     {
         return OperationResponse.Error("未获取到消息");
     }
     Contact sender = contactRepository.GetContactByLoginName(replierLoginName);
     if (sender == null)
     {
         return OperationResponse.Error("未获取到回复人信息");
     }
     Message message = new Message(title, content, sender, replyMessage.Sender);
     if (sendMessageService.SendMessage(message))
     {
         messageRepository.AddMessage(message);
         return OperationResponse.Success("回复成功");
         //return Context.Commit();
     }
     else
     {
         return OperationResponse.Error("回复失败");
     }
 }
 public bool SendMessage(Message message)
 {
     return true;
 }