public void When_a_null_of_settings_passed_to_ctor_then_argument_null_exception_is_thrown() { //// Arrange JsonSchemaValidatorSettings settings = null; //// Act & Assert Assert.Throws <ArgumentNullException>(() => new JsonSchemaValidator(settings)); }
public void When_settings_contain_custom_format_validator_then_it_validates() { //// Arrange var settings = new JsonSchemaValidatorSettings(); var formatValidator = new CustomFormatValidator(); settings.FormatValidators.Add(formatValidator); var validator = new JsonSchemaValidator(settings); var schema = new JsonSchema4 { Type = JsonObjectType.String, Format = formatValidator.Format }; //// Act validator.Validate(@"""test""", schema); //// Assert Assert.True(formatValidator.WasCalled); }