public async Task <IActionResult> List([FromQuery] ListOperatorFromQuery query) { var request = new ListOperatorRequest(query); var result = await _apiResult.Produce(request); return(result); }
public async Task <IActionResult> Produce(ListOperatorRequest request) { var validatorActionResult = await _validationArrangement.Validate(request); var actionResult = await _operationArrangement.Process(request, validatorActionResult); return(actionResult); }
public ListOperatorQuery Map(ListOperatorRequest request) { var filter = request.Filter; var skip = request.Skip; var top = request.Top; var query = new ListOperatorQuery(filter, top, skip); return(query); }
public void ConstructorShouldSucceed() { // Arrange var query = new ListOperatorFromQuery(); // Act var request = new ListOperatorRequest(query); // Assert request.Should().NotBeNull(); }
public async Task <IActionResult> Process(ListOperatorRequest request, IValidatorActionResult validatorActionResult) { IActionResult actionResult; if (validatorActionResult.Result == null) { var query = _cqsMapper.Map(request); var result = await _mediator.Send(query); actionResult = result.IsFailure ? _apiResponse.Fail(result) : _apiResponse.Ok(((Result <OperatorsModel>)result).Value); } else { actionResult = validatorActionResult.Result; } return(actionResult); }
public void MapListOperatorsRequestShouldSucceed() { // Arrange var filter = "?id gt 100"; var skip = "10"; var top = "30"; var apiVersion = "1.0"; // Act var request = new ListOperatorRequest(new ListOperatorFromQuery() { ApiVersion = apiVersion, Filter = filter, Skip = skip, Top = top }); var query = new ListOperatorQuery(filter, top, skip); var mappedQuery = _cqsMapper.Map(request); // Assert query.Should().BeEquivalentTo(mappedQuery); }