public void It_should_match_country_code_exactly(string pattern, string value, bool expectedResult) { // Act IStructureValidator validator = _sut.CreateValidator(string.Empty, pattern); bool result = validator.Validate(value); // Assert result.Should().Be(expectedResult); }
public void Given_pattern_it_should_decompose_into_tests(string pattern, string value, bool expectedResult) { // Act IStructureValidator validator = _sut.CreateValidator(string.Empty, pattern); bool result = validator.Validate(value); // Assert result.Should().Be(expectedResult); }
/// <inheritdoc /> public void Validate(ValidationContext context) { IStructureValidator validator = _structureValidationFactory.CreateValidator( context.Country.TwoLetterISORegionName, context.Country.Iban.Structure ); if (!validator.Validate(context.Value)) { context.Result = IbanValidationResult.InvalidStructure; } }
/// <inheritdoc /> public ValidationRuleResult Validate(ValidationRuleContext context) { if (context.Country is null) { return(new InvalidStructureResult()); } IStructureValidator validator = _structureValidationFactory.CreateValidator( context.Country.TwoLetterISORegionName, context.Country.Iban.Structure ); return(validator.Validate(context.Value) ? ValidationRuleResult.Success : new InvalidStructureResult()); }