public void ValidateFailTest() { PostCodeValidator target = new PostCodeValidator(); string input = "123456"; IResult expected = ResultFactory.GetFailResultInstance("Postcode must be 5 digit only."); IResult actual; actual = target.Validate(input); Assert.AreEqual(expected.IsSuccess, actual.IsSuccess); }
public void ValidateSuccessTest() { PostCodeValidator target = new PostCodeValidator(); string input = "12345"; IResult expected = ResultFactory.GetSuccessResultInstance(); IResult actual; actual = target.Validate(input); Assert.AreEqual(expected.IsSuccess, actual.IsSuccess); }
public async Task Validate_InvalidPostCode_ReturnsInvalidResult() { var validApiResponse = new PostCodeValidationResponse { result = false }; SetupHttpClient(validApiResponse); _postCodeValidator = new PostCodeValidator(_httpClient, _config); var response = await _postCodeValidator.Validate("postCode"); Assert.IsFalse(response.result); }