Ejemplo n.º 1
0
        public void Setup()
        {
            _apiResponse = _fixture.Create <GetAccountsWithCohortsResponse>();
            _apiClient   = new Mock <ICommitmentsV2ApiClient <CommitmentsV2ApiConfiguration> >();
            _apiClient.Setup(x => x.Get <GetAccountsWithCohortsResponse>(It.IsAny <GetAccountsWithCohortsRequest>())).ReturnsAsync(_apiResponse);

            _handler = new GetAccountIdsQueryHandler(_apiClient.Object);

            _query = _fixture.Create <GetAccountIdsQuery>();
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> GetAccountsWithCohorts()
        {
            try
            {
                var queryResult = await _mediator.Send(new GetAccountIdsQuery());

                var result = new GetAccountsWithCohortsResponse {
                    AccountIds = queryResult.AccountIds
                };
                return(Ok(result));
            }
            catch (Exception e)
            {
                _logger.LogError(e, "Exception occurred getting accounts with cohorts");
                throw;
            }
        }