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); }
public void RenderSingleMessage24HourTimeTest() { IConversation conversation = DummyConversationDataGenerator.GetSingleConversation(DummyPhoneNumberId.UnknownEagle); IConversationMessage message = conversation.GetMessage(0); MockDisplayOptions displayOptions = new MockDisplayOptions(); displayOptions.TimeDisplayFormat = TimeDisplayFormat.HourMinSec24h; ConversationRendererRichText_Accessor renderer = new ConversationRendererRichText_Accessor(displayOptions, conversation); List <Inline> inlineListExpected = new List <Inline>(); Span messagePrefix = new Span(); messagePrefix.Inlines.Add(new Bold(new Run("Unknown Sender"))); messagePrefix.Inlines.Add(new Run(" (\u200E20:38:17\u202C)")); messagePrefix.Inlines.Add(new Run(": ")); inlineListExpected.Add(messagePrefix); inlineListExpected.Add(new ConversationContentRun(message.MessageContents)); List <Inline> inlineListActual = new List <Inline>(); inlineListActual.AddRange(renderer.ConversationMessageToInlines(message)); VerifyInlineListsMatch(inlineListExpected, inlineListActual); }
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); }
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; }
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); }
public void RenderSingleMessageHideTimeTest() { IConversation conversation = DummyConversationDataGenerator.GetSingleConversation(DummyPhoneNumberId.UnknownEagle); IConversationMessage message = conversation.GetMessage(0); MockDisplayOptions displayOptions = new MockDisplayOptions(); displayOptions.TimeDisplayFormat = TimeDisplayFormat.HideTime; ConversationRendererRichText_Accessor renderer = new ConversationRendererRichText_Accessor(displayOptions, conversation); List<Inline> inlineListExpected = new List<Inline>(); Span messagePrefix = new Span(); messagePrefix.Inlines.Add(new Bold(new Run("Unknown Sender"))); messagePrefix.Inlines.Add(new Run(": ")); inlineListExpected.Add(messagePrefix); inlineListExpected.Add(new ConversationContentRun(message.MessageContents)); List<Inline> inlineListActual = new List<Inline>(); inlineListActual.AddRange(renderer.ConversationMessageToInlines(message)); VerifyInlineListsMatch(inlineListExpected, inlineListActual); }