Exemple #1
0
 public void A110_Validation_Empty()
 {
     ExpectValidationException.Throws(
         () => 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()
        {
            ExpectValidationException.Throws(
                () => new PersonManager(new Mock <IPersonDataSvc>().Object).CreateAsync(null),
                "Value is required.");

            ExpectValidationException.Throws(
                () => new PersonManager(new Mock <IPersonDataSvc>().Object).UpdateAsync(null, 1.ToGuid()),
                "Value is required.");
        }
Exemple #3
0
 public void A120_Validation_Invalid()
 {
     ExpectValidationException.Throws(
         () => 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 A110_Validation_Null()
        {
            TestSetUp.CreateMock <IPersonData>();
            ExpectValidationException.Throws(
                () => (new PersonManager()).CreateAsync(null),
                "Value is required.");

            ExpectValidationException.Throws(
                () => (new PersonManager()).UpdateAsync(null, 1.ToGuid()),
                "Value is required.");
        }
Exemple #5
0
 public void A150_ArgsValidator_Invalid()
 {
     ExpectValidationException.Throws(() =>
     {
         var ta = new TransactionArgs {
             FromDate = new DateTime(2020, 03, 01), ToDate = new DateTime(2020, 02, 01), MinAmount = 100m, MaxAmount = 80m, Text = "Best*Buy"
         };
         TransactionArgsValidator.Default.Validate(ta).ThrowOnError();
     },
                                      "Oldest time must be less than or equal to Newest time.",
                                      "Min Amount must be less than or equal to Max Amount.",
                                      "Text contains invalid or non-supported wildcard selection.");
 }
Exemple #6
0
 public void A130_Validation_Invalid()
 {
     ExpectValidationException.Throws(
         () => new PersonManager(new Mock <IPersonDataSvc>().Object).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.");
 }