public void CanGetChatList()
        {
            IChatRepository chatRepository = new ChatRepository();
            ICollection<Chat> chats = chatRepository.ListByDraft(_drafts[0]);
            List<Chat> chatlist = chats.ToList();

            Assert.AreEqual(chatlist[0].Text, _chats[2].Text);
            Assert.AreEqual(chatlist[1].Text, _chats[1].Text);
            Assert.AreEqual(chatlist[2].Text, _chats[0].Text);
        }
Beispiel #2
0
        public List<Chat> GetChatList(int draftId)
        {
            IChatRepository cr = new ChatRepository();
            IDraftRepository dr = new DraftRepository();

            var draft = dr.GetById(draftId);
            var res = cr.ListByDraft(draft);

            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);
        }