public List<Chat> GetUpdatedChatList(int draftId, int latestChatId) { IChatRepository cr = new ChatRepository(); IDraftRepository dr = new DraftRepository(); var draft = dr.GetById(draftId); var res = cr.ListNewChatsFromDraft(draft, latestChatId); return res != null ? res.ToList() : new List<Chat>(); }
public void CanGetUpdatedList() { IChatRepository chatRepository = new ChatRepository(); ICollection<Chat> chats = chatRepository.ListByDraft(_drafts[0]); List<Chat> chatlist = chats.ToList(); var chat = new Chat { Draft = _drafts[0], Member = _members[1], Text = "testchattext" }; chatRepository.Add(chat); List<Chat> newChats = chatRepository.ListNewChatsFromDraft(_drafts[0], chatlist[0].Id).ToList(); Assert.AreEqual(1, newChats.Count); Assert.AreEqual(newChats[0].Text, chat.Text); }