public async Task Should_retrieve_the_suitability_answers_cursor_null() { var response = new SuitabilityAnswersResponse(); _userIdentityMock.Setup(s => s.IsVhOfficerAdministratorRole()).Returns(true); _bookingsApiClientMock.Setup(s => s.GetSuitabilityAnswersAsync(null, 1)).ReturnsAsync(response); var result = await _controller.GetSuitabilityAnswersList(null, 1); result.Should().NotBeNull(); var objectResult = (ObjectResult)result; objectResult.StatusCode.Should().Be((int)HttpStatusCode.OK); }
public async Task <ActionResult <SuitabilityAnswersResponse> > GetSuitabilityAnswers([FromQuery] string cursor = DefaultCursor, [FromQuery] int limit = DefaultLimit) { var query = new GetParticipantWithSuitabilityAnswersQuery() { Cursor = cursor == DefaultCursor ? null : cursor, Limit = limit }; var result = await _queryHandler.Handle <GetParticipantWithSuitabilityAnswersQuery, CursorPagedResult <Participant, string> >(query); var mapper = new SuitabilityAnswersListToResponseMapper(); var response = new SuitabilityAnswersResponse { PrevPageUrl = BuildCursorPageUrl(cursor, limit), NextPageUrl = BuildCursorPageUrl(result.NextCursor, limit), NextCursor = result.NextCursor, Limit = limit, ParticipantSuitabilityAnswerResponse = mapper.MapParticipantSuitabilityAnswerResponses(result) }; return(Ok(response)); }