public PasswordValidationResponse Validate(PasswordValidationRequest request) { var isValid = _validatorService.Validate(request.Password); return(new PasswordValidationResponse { Valid = isValid }); }
public async Task PostInvalidPasswordReturnInvalidResult(string password) { var client = _clientFactory.CreateClient(); PasswordValidationRequest requestPayload = new PasswordValidationRequest { Password = password }; StringContent content = new StringContent(JsonSerializer.Serialize(requestPayload), Encoding.UTF8, "application/json"); var response = await client.PostAsync(passwordRoute, content); Assert.Equal(System.Net.HttpStatusCode.OK, response.StatusCode); var responseString = await response.Content.ReadAsStringAsync(); var responsePayload = JsonSerializer.Deserialize <PasswordValidationResponse>(responseString, jsonSerializerOptions); Assert.False(responsePayload.Valid); }
public ActionResult <PasswordValidationResponse> Validate(PasswordValidationRequest request) { return(Ok(passwordAppService.Validate(request))); }