Ejemplo n.º 1
0
        public void ShouldGetMessagesForUser()
        {
            //arrange
            var usersRepository    = new UsersRepository(_connectionString);
            var chatsRepository    = new ChatsRepository(_connectionString, usersRepository);
            var messagesRepository = new MessagesRepository(_connectionString, usersRepository, chatsRepository);

            //act
            var messagesOfUser = messagesRepository.GetMessagesForUser(_chat.Id, _messages[0].User.Id);

            //assert
            Assert.IsNotNull(messagesOfUser);
            Assert.IsTrue(messagesOfUser.Select(x => x.Id).Contains(_messages[0].Id));
        }