コード例 #1
0
        public void NoMessageConversationTest()
        {
            IConversation conversation = DummyConversationDataGenerator.GetSingleConversation(DummyPhoneNumberId.NeverTexterCell);
            IDisplayOptions displayOptions = new MockDisplayOptions();

            ConversationRendererRichText renderer = new ConversationRendererRichText(displayOptions, conversation);

            List<Paragraph> paragraphsActual = renderer.RenderMessagesAsParagraphs(ConversationRendererRichText.RenderAllMessages);
            Assert.AreEqual(1, paragraphsActual.Count);

            Paragraph paragraphExpected = new Paragraph(new Italic(new Run(ConversationRendererRichText_Accessor._noConversationMessage)));
            VerifyParagraphsEqual(paragraphExpected, paragraphsActual[0]);

            //
            // Calling RenderMessages after messages have been rendered should return empty list.
            //

            paragraphsActual = renderer.RenderMessagesAsParagraphs(ConversationRendererRichText.RenderAllMessages);
            Assert.AreEqual(0, paragraphsActual.Count);
        }
コード例 #2
0
        private static RichTextBox GetConversationRichTextBox()
        {
            IConversation conversation = DummyConversationDataGenerator.GetSingleConversation(DummyPhoneNumberId.ObamaCell);

            ConversationRendererRichText renderer = new ConversationRendererRichText(new MockDisplayOptions(), conversation);

            IEnumerable<Paragraph> paragraphs = renderer.RenderMessagesAsParagraphs(ConversationRendererRichText.RenderAllMessages);

            RichTextBox conversationRichTextBox = new RichTextBox();
            conversationRichTextBox.Document.Blocks.Clear();
            conversationRichTextBox.Document.Blocks.AddRange(paragraphs);

            return conversationRichTextBox;
        }