Exemplo n.º 1
0
        private static IMessageSender CreateMessageSenderMock(MessageSenderType senderType, SendStatus statusToReturn)
        {
            var messageSenderMock = A.Fake <IMessageSender>();

            A.CallTo(() => messageSenderMock.SenderType).Returns(senderType);
            A.CallTo(() => messageSenderMock.Send(A <User> .Ignored, A <string> .Ignored)).Returns(statusToReturn);
            return(messageSenderMock);
        }
Exemplo n.º 2
0
        private Task SendConfirmCodeAsync(ApplicationUser user, string confirmCode, MessageSenderType senderType)
        {
            var userModel = Mapper.Map <UserModel>(user);

            m_messageSenderManager.SendMessage(userModel, senderType, m_translator.Translate("confirmation-code-subject"),
                                               string.Format(m_translator.Translate("confirmation-code-message"), user.UserName, confirmCode));

            return(Task.CompletedTask);
        }
Exemplo n.º 3
0
 public Message(
     string text,
     MessageSenderType senderType = MessageSenderType.User,
     User senderUser  = null,
     MessageType type = MessageType.Text
     )
 {
     Type       = type;
     SenderType = senderType;
     SenderUser = senderUser;
     Text       = text;
     Time       = DateTime.Now;
 }
Exemplo n.º 4
0
 /// <summary>
 /// 消息已发送 事件参数
 /// </summary>
 /// <param name="senderType">发送者类型</param>
 /// <param name="context">消息传输上下文</param>
 public MessageSentEventArgs(MessageSenderType senderType, IMessageTransportationContext context)
 {
     SenderType = senderType;
     Context    = context;
 }
Exemplo n.º 5
0
 public void SendMessage(UserModel user, MessageSenderType messageSenderType, string subject, string message)
 {
     m_messageSendersDict[messageSenderType].SendMessageAsync(user, subject, message);
 }