public static IConversation GetChatConversation(DummyChatRoomId chatRoomId) { List <IContact> contacts = new List <IContact>(); List <TextMessage> messages = DummyConversationDataGenerator.GetMessageSet(chatRoomId); List <ChatRoomInformation> chatInfoItems = new List <ChatRoomInformation>(); ChatRoomInformation chatRoomInfo = GetChatRoomInfo(chatRoomId); chatInfoItems.Add(chatRoomInfo); List <MessageAttachment> attachments = new List <MessageAttachment>(); foreach (string phoneNumberValue in chatRoomInfo.Participants) { IContact associatedContact = GetContactByPhoneNumber(phoneNumberValue); if (associatedContact != null) { contacts.Add(associatedContact); } } ConversationManager conversationManager = new ConversationManager(contacts, messages, chatInfoItems, attachments, null); foreach (IConversation conversation in conversationManager) { if (conversation.MessageCount > 0) { return(conversation); } } throw new ArgumentException("Shouldn't reach here!"); }
public static IConversation GetChatConversation(DummyChatRoomId chatRoomId) { List<IContact> contacts = new List<IContact>(); List<TextMessage> messages = DummyConversationDataGenerator.GetMessageSet(chatRoomId); List<ChatRoomInformation> chatInfoItems = new List<ChatRoomInformation>(); ChatRoomInformation chatRoomInfo = GetChatRoomInfo(chatRoomId); chatInfoItems.Add(chatRoomInfo); List<MessageAttachment> attachments = new List<MessageAttachment>(); foreach (string phoneNumberValue in chatRoomInfo.Participants) { IContact associatedContact = GetContactByPhoneNumber(phoneNumberValue); if (associatedContact != null) { contacts.Add(associatedContact); } } ConversationManager conversationManager = new ConversationManager(contacts, messages, chatInfoItems, attachments, null); foreach (IConversation conversation in conversationManager) { if (conversation.MessageCount > 0) { return conversation; } } throw new ArgumentException("Shouldn't reach here!"); }
public static List<TextMessage> GetMessageSet(DummyChatRoomId chatId) { string chatRoomName = GetChatRoomInfo(chatId).ChatId; return _DummyMessageSets[chatRoomName].MessageList; }
public static ChatRoomInformation GetChatRoomInfo(DummyChatRoomId chatRoomId) { return _DummyChatRoomInfoItems[(int)chatRoomId]; }
private void VerifyChatConversationDescription(DummyChatRoomId chatRoomId, string descriptionExpected) { IConversation conversation = DummyConversationDataGenerator.GetChatConversation(chatRoomId); VerifyConversationDescription(conversation, descriptionExpected); }
private void VerifyHeaderContentTitleLineMatches(DummyChatRoomId chatRoomId, string titleLineExpected) { IConversation conversation = DummyConversationDataGenerator.GetChatConversation(chatRoomId); VerifyHeaderContentTitleLineMatchesByConversation(conversation, titleLineExpected); }
private void VerifyTitleMatchesExpected(DummyChatRoomId chatRoomId, string titleExpected) { IConversation conversation = DummyConversationDataGenerator.GetChatConversation(chatRoomId); VerifyTitleMatchesExpected(conversation, titleExpected); }
public static List <TextMessage> GetMessageSet(DummyChatRoomId chatId) { string chatRoomName = GetChatRoomInfo(chatId).ChatId; return(_DummyMessageSets[chatRoomName].MessageList); }
public static ChatRoomInformation GetChatRoomInfo(DummyChatRoomId chatRoomId) { return(_DummyChatRoomInfoItems[(int)chatRoomId]); }
private static void InitChatRoomInfoItems() { int chatRoomInfoItemCount = Enum.GetValues(typeof(DummyChatRoomId)).Length; ChatRoomInformation[] dummyChatRoomInfoItems = new ChatRoomInformation[chatRoomInfoItemCount]; { DummyChatRoomId chatId = DummyChatRoomId.ChatRoomA; string[] participants = { GetPhoneNumber(DummyPhoneNumberId.ObamaCell), GetPhoneNumber(DummyPhoneNumberId.AnthonyWeinerCell) }; dummyChatRoomInfoItems[(int)chatId] = new ChatRoomInformation("chat901258305184729544", participants); } { DummyChatRoomId chatId = DummyChatRoomId.ChatRoomB; string[] participants = { GetPhoneNumber(DummyPhoneNumberId.TonyWolfCell), GetPhoneNumber(DummyPhoneNumberId.VictoriaWolfCell) }; dummyChatRoomInfoItems[(int)chatId] = new ChatRoomInformation("chat901258305184729566", participants); } { DummyChatRoomId chatId = DummyChatRoomId.ChatRoomC; string[] participants = { GetPhoneNumber(DummyPhoneNumberId.ObamaCell), GetPhoneNumber(DummyPhoneNumberId.HarryLooseTieCell), GetPhoneNumber(DummyPhoneNumberId.AnthonyWeinerCell), GetPhoneNumber(DummyPhoneNumberId.ReliableLarryOffice) }; dummyChatRoomInfoItems[(int)chatId] = new ChatRoomInformation("chat901258305184725792", participants); } { DummyChatRoomId chatId = DummyChatRoomId.ChatRoomD; string[] participants = { GetPhoneNumber(DummyPhoneNumberId.HarryLooseTieCell), GetPhoneNumber(DummyPhoneNumberId.UnknownLawnmower) }; dummyChatRoomInfoItems[(int)chatId] = new ChatRoomInformation("chat901258305184724753", participants); } foreach (ChatRoomInformation cri in dummyChatRoomInfoItems) { if (cri == null) { throw new ArgumentException("You forgot to initialize a chat room information item."); } } _DummyChatRoomInfoItems = dummyChatRoomInfoItems; }
private ConversationManager CreateConversationManager(DummyContactId[] contactIds, DummyPhoneNumberId[] messageSetIds, DummyChatRoomId[] chatRoomIds, ILoadingProgressCallback progressCallback) { if (progressCallback != null) { int messageCount = DummyConversationDataGenerator.GetMessageCount(messageSetIds); int workEstimate = ConversationManager.GetWorkEstimate(contactIds.Length, messageCount, chatRoomIds.Length, 0); progressCallback.Begin(workEstimate); } ConversationManager conversationManager = DummyConversationDataGenerator.GetConversationManager(contactIds, messageSetIds, chatRoomIds, progressCallback); if (progressCallback != null) { progressCallback.End(); } return conversationManager; }
private void VerifyExportErrorString(DummyChatRoomId chatRoomId, Exception ex, string descriptionExpected) { IConversation conversation = DummyConversationDataGenerator.GetChatConversation(chatRoomId); VerifyExportErrorString(conversation, ex, descriptionExpected); }