SetDefaultCulture() 공개 정적인 메소드

public static SetDefaultCulture ( ) : void
리턴 void
예제 #1
0
        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;
        }
예제 #3
0
        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()
            };
        }
예제 #9
0
        public PhoneValidatorTests()
        {
            CultureScope.SetDefaultCulture();

            validator = new TestValidator {
                v => v.RuleFor(x => x.PhoneNumber).Phone()
            };
        }
예제 #10
0
        public EnumValidatorTests()
        {
            CultureScope.SetDefaultCulture();

            validator = new TestValidator {
                v => v.RuleFor(x => x.Gender).IsInEnum()
            };
        }
예제 #11
0
        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>()
            };
        }
예제 #12
0
        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>();
            });
        }
예제 #13
0
        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();
 }
예제 #18
0
 public DisplayAttributeTests()
 {
     CultureScope.SetDefaultCulture();
 }
예제 #19
0
 public LengthValidatorTests()
 {
     CultureScope.SetDefaultCulture();
 }
 public InclusiveBetweenValidatorTests()
 {
     CultureScope.SetDefaultCulture();
     fromDate = new DateTime(2009, 1, 1);
     toDate   = new DateTime(2009, 12, 31);
 }
예제 #21
0
 public LocalisedNameTester()
 {
     CultureScope.SetDefaultCulture();
 }
예제 #22
0
 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();
 }
예제 #26
0
 public ValidatorDescriptorTester()
 {
     CultureScope.SetDefaultCulture();
     validator = new TestValidator();
 }
 public EqualValidatorTests()
 {
     CultureScope.SetDefaultCulture();
 }
예제 #28
0
 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));
 }