コード例 #1
0
        public IncomingEmailMessageMock AddReply(IIncomingEmailMessage message, string replyText)
        {
            // Reply body contains the reply text, then a message separator, then the previous message's full text
            var bodyBuilder = new StringBuilder(replyText);

            bodyBuilder.AppendLine(RandomDataHelper.GetRandomMessageSeparator(_rand.Next()));
            bodyBuilder.AppendLine(message.PlainTextBody);

            var newMessage = AddMessage("RE: " + message.Subject, bodyBuilder.ToString());

            newMessage.SentOn         = message.SentOn.AddSeconds(1);
            newMessage.ConversationId = GenerateReplyIndex(message.ConversationId);

            return(newMessage);
        }
コード例 #2
0
        public void TestGetLastMessageTextBasic()
        {
            var message = new IncomingEmailMessageMock();

            var lastMessageText = RandomDataHelper.GetBody(_rand.Next());
            var numOfReplies    = _rand.Next(0, 100);
            var bodyBuilder     = new StringBuilder(lastMessageText);

            for (var i = 0; i < numOfReplies; i++)
            {
                bodyBuilder.AppendLine(RandomDataHelper.GetRandomMessageSeparator(_rand.Next()));
                bodyBuilder.Append(RandomDataHelper.GetBody(_rand.Next()));
            }
            message.PlainTextBody = bodyBuilder.ToString();

            Assert.AreEqual(lastMessageText, EmailBodyProcessingUtils.GetLastMessageText(message), "Verifying extracted last message text correctness");
        }