Exemple #1
0
 public void A110_Validation_Empty()
 {
     ExpectValidationException.Run(
         () => PersonValidator.Default.Validate(new Person()).ThrowOnError(),
         "First Name is required.",
         "Last Name is required.",
         "Gender is required.",
         "Birthday is required.");
 }
Exemple #2
0
        public void A110_Validation_Null()
        {
            TestSetUp.CreateMock <IPersonData>();
            ExpectValidationException.Run(
                () => (new PersonManager()).CreateAsync(null),
                "Value is required.");

            ExpectValidationException.Run(
                () => (new PersonManager()).UpdateAsync(null, 1.ToGuid()),
                "Value is required.");
        }
Exemple #3
0
 public void A120_Validation_Invalid()
 {
     ExpectValidationException.Run(
         () => PersonValidator.Default.Validate(new Person {
         FirstName = 'x'.ToLongString(), LastName = 'x'.ToLongString(), Gender = "X", Birthday = DateTime.Now.AddDays(1)
     }).ThrowOnError(),
         "First Name must not exceed 100 characters in length.",
         "Last Name must not exceed 100 characters in length.",
         "Gender is invalid.",
         "Birthday must be less than or equal to Today.");
 }
Exemple #4
0
 public void A130_Validation_Invalid()
 {
     TestSetUp.CreateMock <IPersonData>();
     ExpectValidationException.Run(
         () => (new PersonManager()).CreateAsync(new Person()
     {
         FirstName = 'x'.ToLongString(), LastName = 'x'.ToLongString(), Birthday = DateTime.Now.AddDays(1), Gender = "X", EyeColor = "Y"
     }),
         "First Name must not exceed 50 characters in length.",
         "Last Name must not exceed 50 characters in length.",
         "Gender is invalid.",
         "Eye Color is invalid.",
         "Birthday must be less than or equal to Today.");
 }