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>(); }
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; } }