Exemplo n.º 1
0
        public async Task <QueryResult <StoreItemViewModel> > Handle(Request request, CancellationToken cancellationToken)
        {
            var(total, items) =
                await _repository.FindAsync(_userContext.UserId, QueryParams.Create(request), cancellationToken);

            return(new QueryResult <StoreItemViewModel>(total, items));
        }
Exemplo n.º 2
0
    public async Task GivenHandler_WhenIdFound_ThenReturnResult()
    {
        // arrange
        var request = _faker.Generate();

        _repositoryMock.FindAsync(Arg.Is(_userContextMock.UserId), Arg.Any <QueryParams>(), Arg.Any <CancellationToken>())
        .Returns((_countDummy, _dummy));

        var handler = new Handler(_userContextMock, _repositoryMock);

        // act
        var result = await handler.Handle(request, default);

        // assert
        result.Should().Be(new QueryResult <StoreItemViewModel>(_countDummy, _dummy));
    }