Example #1
0
        private List <Paragraph> GetMultiDayConversationRenderingExpected(IConversation conversation, ConversationRendererRichText_Accessor renderer)
        {
            List <IConversationMessage> messages           = new List <IConversationMessage>(conversation);
            List <Paragraph>            paragraphsExpected = new List <Paragraph>();

            Paragraph paragraph = new Paragraph();

            paragraph.Inlines.Add(ConversationRendererRichText_Accessor.DateAsInline(messages[0].Timestamp));
            paragraph.Inlines.Add(new LineBreak());
            paragraph.Inlines.AddRange(renderer.ConversationMessageToInlines(messages[0]));
            paragraph.Inlines.Add(new LineBreak());
            paragraph.Inlines.AddRange(renderer.ConversationMessageToInlines(messages[1]));
            paragraphsExpected.Add(paragraph);

            paragraph = new Paragraph();
            paragraph.Inlines.Add(new LineBreak());
            paragraph.Inlines.Add(ConversationRendererRichText_Accessor.DateAsInline(messages[2].Timestamp));
            paragraph.Inlines.Add(new LineBreak());
            paragraph.Inlines.AddRange(renderer.ConversationMessageToInlines(messages[2]));
            paragraph.Inlines.Add(new LineBreak());
            paragraph.Inlines.AddRange(renderer.ConversationMessageToInlines(messages[3]));
            paragraphsExpected.Add(paragraph);

            return(paragraphsExpected);
        }
Example #2
0
        public void SingleMessageConversationTest()
        {
            IConversation   conversation   = DummyConversationDataGenerator.GetSingleConversation(DummyPhoneNumberId.UnknownEagle);
            IDisplayOptions displayOptions = new MockDisplayOptions();

            ConversationRendererRichText_Accessor renderer = new ConversationRendererRichText_Accessor(displayOptions, conversation);

            List <Paragraph> paragraphsActual = renderer.RenderMessagesAsParagraphs(ConversationRendererRichText.RenderAllMessages);

            Assert.AreEqual(1, paragraphsActual.Count);

            IConversationMessage message = conversation.GetMessage(0);

            Paragraph paragraphExpected = new Paragraph();

            paragraphExpected.Inlines.Add(ConversationRendererRichText_Accessor.DateAsInline(message.Timestamp));
            paragraphExpected.Inlines.Add(new LineBreak());
            paragraphExpected.Inlines.AddRange(renderer.ConversationMessageToInlines(message));

            VerifyParagraphsEqual(paragraphExpected, paragraphsActual[0]);

            paragraphsActual = renderer.RenderMessagesAsParagraphs(ConversationRendererRichText.RenderAllMessages);
            Assert.AreEqual(0, paragraphsActual.Count);
        }