public DependencyInjectionTests(ITestOutputHelper output, WebAppFixture <StartupForDependencyInjectionTests> webApp) { CultureScope.SetDefaultCulture(); _output = output; _webApp = webApp; }
public RazorPagesTestsWithImplicitValidationEnabled(ITestOutputHelper output, WebAppFixture <Startup> webApp) { CultureScope.SetDefaultCulture(); this._output = output; this._webApp = webApp; }
public RazorPagesTestsWithImplicitValidationEnabled(ITestOutputHelper output, WebAppFixture webApp) { CultureScope.SetDefaultCulture(); _output = output; _client = webApp.WithImplicitValidationEnabled(true).CreateClient(); }
public ValidatorTesterTester() { validator = new TestValidator(); validator.RuleFor(x => x.Forename).NotNull(); validator.RuleForEach(person => person.NickNames).MinimumLength(5); CultureScope.SetDefaultCulture(); }
public PredicateValidatorTester() { CultureScope.SetDefaultCulture(); validator = new TestValidator { v => v.RuleFor(x => x.Forename).Must(forename => forename == "Jeremy") }; }
public ValidatorTesterTester() { validator = new TestValidator(); validator.RuleFor(x => x.CreditCard).Must(creditCard => !string.IsNullOrEmpty(creditCard)).WhenAsync((x, cancel) => Task.Run(() => { return(x.Age >= 18); })); validator.RuleFor(x => x.Forename).NotNull(); validator.RuleForEach(person => person.NickNames).MinimumLength(5); CultureScope.SetDefaultCulture(); }
public CreditCardValidatorTests() { CultureScope.SetDefaultCulture(); validator = new TestValidator { v => v.RuleFor(x => x.CreditCard).CreditCard() }; }
public EmailValidatorTests() { CultureScope.SetDefaultCulture(); validator = new TestValidator { v => v.RuleFor(x => x.Email).EmailAddress() }; }
public PhoneValidatorTests() { CultureScope.SetDefaultCulture(); validator = new TestValidator { v => v.RuleFor(x => x.PhoneNumber).Phone() }; }
public EnumValidatorTests() { CultureScope.SetDefaultCulture(); validator = new TestValidator { v => v.RuleFor(x => x.Gender).IsInEnum() }; }
public GenericStringEnumValidatorTests() { CultureScope.SetDefaultCulture(); _caseInsensitiveValidator = new TestValidator { v => v.RuleFor(x => x.GenderString).IsEnumName <Person, EnumGender>(false) }; _caseSensitiveValidator = new TestValidator { v => v.RuleFor(x => x.GenderString).IsEnumName <Person, EnumGender>() }; }
public RazorPagesTestsWithImplicitValidationDisabled(ITestOutputHelper output, WebAppFixture webApp) { CultureScope.SetDefaultCulture(); _output = output; _client = webApp.CreateClientWithServices(services => { services.AddMvc().AddNewtonsoftJson().AddFluentValidation(); services.AddScoped <IValidator <TestModel>, TestModelValidator>(); services.AddScoped <IValidator <RulesetTestModel>, RulesetTestValidator>(); services.AddScoped <IValidator <ClientsideRulesetModel>, ClientsideRulesetValidator>(); }); }
public StringEnumValidatorTests() { CultureScope.SetDefaultCulture(); _caseInsensitiveValidator = new TestValidator { v => v.RuleFor(x => x.GenderString).IsEnumName(typeof(EnumGender), false) }; _caseSensitiveValidator = new TestValidator { v => v.RuleFor(x => x.GenderString).IsEnumName(typeof(EnumGender), true) }; }
public RegularExpressionValidatorTests() { CultureScope.SetDefaultCulture(); validator = new TestValidator { v => v.RuleFor(x => x.Surname).Matches(@"^\w\d$") }; validator2 = new TestValidator { v => v.RuleFor(x => x.Surname).Matches(x => x.Regex) }; validator3 = new TestValidator { v => v.RuleFor(x => x.Surname).Matches(x => x.AnotherRegex) }; }
public DependencyInjectionTests(ITestOutputHelper output, WebAppFixture webApp) { CultureScope.SetDefaultCulture(); _output = output; _client = webApp.WithWebHostBuilder(webHostBuilder => { webHostBuilder.ConfigureServices(services => { services.AddMvc().AddNewtonsoftJson().AddFluentValidation(fv => { fv.ImplicitlyValidateChildProperties = false; }); services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); services.AddScoped <IValidator <ParentModel>, InjectsExplicitChildValidator>(); services.AddScoped <IValidator <ChildModel>, InjectedChildValidator>(); services.AddScoped <IValidator <ParentModel6>, InjectsExplicitChildValidatorCollection>(); }); }) .CreateClient(); }
public void Dispose() { CultureScope.SetDefaultCulture(); }
public LocalisedMessagesTester() { // ensure the resource provider is reset after any tests that use it. CultureScope.SetDefaultCulture(); }
public DisplayAttributeTests() { CultureScope.SetDefaultCulture(); }
public LengthValidatorTests() { CultureScope.SetDefaultCulture(); }
public InclusiveBetweenValidatorTests() { CultureScope.SetDefaultCulture(); fromDate = new DateTime(2009, 1, 1); toDate = new DateTime(2009, 12, 31); }
public LocalisedNameTester() { CultureScope.SetDefaultCulture(); }
public CustomMessageFormatTester() { validator = new TestValidator(); CultureScope.SetDefaultCulture(); }
public ModelLevelValidatorTests() { CultureScope.SetDefaultCulture(); }
public AbstractValidatorTester() { CultureScope.SetDefaultCulture(); validator = new TestValidator(); testValidatorWithPreValidate = new TestValidatorWithPreValidate(); }
public LessThanValidatorTester() { CultureScope.SetDefaultCulture(); }
public ValidatorDescriptorTester() { CultureScope.SetDefaultCulture(); validator = new TestValidator(); }
public EqualValidatorTests() { CultureScope.SetDefaultCulture(); }
public MessageFormatterTests() { CultureScope.SetDefaultCulture(); formatter = new MessageFormatter(); }
public ScalePrecisionValidatorTests() { CultureScope.SetDefaultCulture(); }
public LessThanOrEqualToValidatorTester() { CultureScope.SetDefaultCulture(); validator = new TestValidator(v => v.RuleFor(x => x.Id).LessThanOrEqualTo(value)); }