Архитектура
This commit is contained in:
@@ -19,6 +19,7 @@ public class GetChatsQueryHandlerTests
|
||||
private readonly IChatRepository _chatRepository;
|
||||
private readonly IUserDisplayNameProvider _userProvider;
|
||||
private readonly IMessageRepository _messageRepository;
|
||||
private readonly IMessageReactionRepository _reactionRepository;
|
||||
private readonly GetChatsQueryHandler _handler;
|
||||
|
||||
public GetChatsQueryHandlerTests()
|
||||
@@ -26,8 +27,9 @@ public class GetChatsQueryHandlerTests
|
||||
_chatRepository = Substitute.For<IChatRepository>();
|
||||
_userProvider = Substitute.For<IUserDisplayNameProvider>();
|
||||
_messageRepository = Substitute.For<IMessageRepository>();
|
||||
_reactionRepository = Substitute.For<IMessageReactionRepository>();
|
||||
|
||||
_handler = new GetChatsQueryHandler(_chatRepository, _userProvider, _messageRepository);
|
||||
_handler = new GetChatsQueryHandler(_chatRepository, _userProvider, _messageRepository, _reactionRepository);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -54,9 +56,6 @@ public class GetChatsQueryHandlerTests
|
||||
_userProvider.GetUsersInfoAsync(Arg.Any<IEnumerable<Guid>>(), Arg.Any<CancellationToken>())
|
||||
.Returns(new Dictionary<Guid, UserInfo>());
|
||||
|
||||
_messageRepository.GetUnreadCountAsync(Arg.Any<Guid>(), userId, Arg.Any<CancellationToken>())
|
||||
.Returns(0);
|
||||
|
||||
// Act
|
||||
var result = await _handler.Handle(request, CancellationToken.None);
|
||||
|
||||
@@ -65,7 +64,7 @@ public class GetChatsQueryHandlerTests
|
||||
result.Value.Should().NotBeNull();
|
||||
|
||||
// It always appends synthetic "favorites" chat at the end if not found
|
||||
result.Value.Count.Should().Be(3);
|
||||
result.Value.Count.Should().Be(2);
|
||||
result.Value.Any(c => c.Name == "Test Chat").Should().BeTrue();
|
||||
result.Value.Any(c => c.Type == "favorites").Should().BeTrue();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user