public void GivenInvalidRequest_ThenIsInvalid(int?schemeId, string address, int?page, int?pageSize, string region) { SearchAssetApiRequest apiRequest = new SearchAssetApiRequest { SchemeId = schemeId, Address = address, Page = page, PageSize = pageSize, Region = region }; apiRequest.IsValid().Should().BeFalse(); }
public void GivenValidRequest_ThenIsValid(int?schemeId, string address, int?page, int?pageSize, string region, string developer) { SearchAssetApiRequest apiRequest = new SearchAssetApiRequest { SchemeId = schemeId, Address = address, Page = page, PageSize = pageSize, Region = region, Developer = developer }; apiRequest.IsValid().Should().BeTrue(); }
public async Task <IActionResult> Get([FromQuery] SearchAssetApiRequest request) { if (!request.IsValid()) { return(StatusCode(400)); } var assetRegisterVersionId = await GetLatestAssetRegisterVersionIdIfNull(request); var searchAssetUseCaseRequest = new SearchAssetRequest { SchemeId = request.SchemeId, Address = request.Address, Page = request.Page, PageSize = request.PageSize, AssetRegisterVersionId = assetRegisterVersionId, }; SearchAssetResponse result = await _useCase .ExecuteAsync(searchAssetUseCaseRequest, this.GetCancellationToken()).ConfigureAwait(false); return(this.StandardiseResponse <SearchAssetResponse, AssetOutputModel>(result)); }