public void DomainTest_ReadInbox()
 {
     Contact recipient = new Recipient("recipient");
     var messages = new List<Message>() { new Message("title", "content", new Sender("sender"), recipient) }.Where(m => m.Recipient == recipient);
     foreach (Message message in messages)
     {
         Console.WriteLine("ID:" + message.ID);
         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_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_GetUnreadMessageCount()
 {
     Contact recipient = new Recipient("recipient");
     int messageCount = new List<Message>() { new Message("title", "content", new Sender("sender"), recipient) }.Where(m => m.Recipient == recipient).Count();
     Console.WriteLine("未读消息个数:" + messageCount);
 }
 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));
 }