mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 19:54:55 +00:00
MessageRepositoryTests
+ Given_ValidSenderId_When_FindBySenderIdAsync_Then_ReturnMessages + Given_InvalidSenderId_When_FindBySenderId_Should_Throw_NotFoundByKeyException
This commit is contained in:
@@ -35,9 +35,13 @@ public class MessagesRepository : IMessagesRepository
|
||||
?? throw new NotFoundByKeyException<Guid>(messageId, "Message with given id does not exist");
|
||||
}
|
||||
|
||||
public Task<List<Message>> FindBySenderIdAsync(Guid senderId)
|
||||
public async Task<List<Message>> FindBySenderIdAsync(Guid senderId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return await _context.Messages
|
||||
.AsNoTracking()
|
||||
.Include(m => m.ReplyToMessage)
|
||||
.Where(m => m.SenderId == senderId)
|
||||
.ToListOrThrowIfEmpty(new NotFoundByKeyException<Guid>(senderId, "Messages with given sender id do not exist"));
|
||||
}
|
||||
|
||||
public Task<List<Message>> FindByReceiverIdAsync(Guid receiverId)
|
||||
|
||||
Reference in New Issue
Block a user