Exemple #1
0
        public void Delete()
        {
            var repo = new MessagesRepository(fixture.Db);

            repo.Delete(3);
            Assert.Throws <MessageNotFoundException>(() => repo.Get(3));
        }
Exemple #2
0
 public void Delete()
 {
     using (MessagesRepository repo = new MessagesRepository(DataContext))
     {
         repo.Delete(_id);
     }
 }
Exemple #3
0
        public void ShouldSendAndDeleteMessage()
        {
            //arrange
            var user = new User
            {
                Name    = "testCharUser",
                Picture = new byte[] {}
            };
            var    login    = "******";
            var    password = "******";
            var    title    = "chatTitle";
            var    pic      = new byte[] {};
            string msg      = "TestText of msg";

            //act
            var userRepository = new UsersRepository(ConnectionString);
            var resultUser     = userRepository.Create(user, login, password);
            var userIds        = new List <Guid> {
                resultUser.Id
            };

            _tempUsers.AddRange(userIds);
            var chatRepository = new ChatsRepository(ConnectionString);
            var resultChat     = chatRepository.Create(title, userIds, pic);

            _tempChats.Add(resultChat.Id);
            var messageRepository = new MessagesRepository(ConnectionString);
            var resultMsg         = messageRepository.Send(msg, resultUser.Id, resultChat.Id);

            messageRepository.Delete(resultMsg.Id);

            //asserts
            Assert.AreEqual(false, messageRepository.MessageExists(resultMsg.Id));
            Assert.AreEqual(false, chatRepository.GetChatMessages(resultChat.Id).Any(m => m.Id == resultMsg.Id));
        }
 public IActionResult Delete(long id)
 {
     try
     {
         _msgRepo.Delete(id);
     }
     catch (MessageNotFoundException)
     {
         return(NotFound());
     }
     return(NoContent());
 }
 public async Task <bool> Delete(int item)
 {
     return(await _repository.Delete(item));
 }
 public IActionResult Delete(int id)
 {
     _messageRepo.Delete(id);
     return(NoContent());
 }
Exemple #7
0
 public void DeleteMessage(Guid idMessage)
 {
     messagesRepository.Delete(idMessage);
 }
 public void Delete(string messageId) => _messagesRepository.Delete(messageId);
        // GET: MessagesController/Delete/5
        public ActionResult Delete(int id)
        {
            messagesRepository.Delete(id);

            return(RedirectToAction(nameof(Index)));
        }
Exemple #10
0
        public void DeleteNonExistant()
        {
            var repo = new MessagesRepository(fixture.Db);

            Assert.Throws <MessageNotFoundException>(() => repo.Delete(100));
        }
 public Response Delete(long MessageID)
 {
     return(repo.Delete(MessageID));
 }