public void Test_SaveObservableChatDictionaryList_Index_Access() { // Add with different chat IDs: SaveObservableChatDictionaryList chats = new SaveObservableChatDictionaryList(); for (int i = 0; i < 1000; i++) { chats.Add(GetNewChat(i)); Assert.AreEqual(i + 1, chats.Count); } for (int i = 0; i < 1000; i++) { ChatDataTemplate chat = chats[i]; Assert.IsNotNull(chat); Assert.AreEqual(i, chats[i].Index); } }
public void Test_SaveObservableChatDictionaryList_Add() { // Add with different chat IDs: SaveObservableChatDictionaryList chats = new SaveObservableChatDictionaryList(); for (int i = 0; i < 1000; i++) { chats.Add(GetNewChat(i)); Assert.AreEqual(i + 1, chats.Count); } // Add the same chat ID: for (int i = 0; i < 1000; i++) { chats.Add(GetNewChat(42)); Assert.AreEqual(1000, chats.Count); } }
public void Test_SaveObservableChatDictionaryList_AddRange() { // Add with different chat IDs: SaveObservableChatDictionaryList chats = new SaveObservableChatDictionaryList(); List <ChatDataTemplate> chatsTmp = new List <ChatDataTemplate>(); for (int i = 0; i < 1000; i++) { chatsTmp.Add(GetNewChat(i)); } chats.AddRange(chatsTmp, true); Assert.AreEqual(1000, chats.Count); // Add the same chat ID: chatsTmp.Clear(); for (int i = 0; i < 1000; i++) { chatsTmp.Add(GetNewChat(1001)); } chats.AddRange(chatsTmp, true); Assert.AreEqual(1001, chats.Count); }