Esempio n. 1
0
 public void Given_validPerson()
 {
     Assert.Empty(Validations.Validate(new Person {
         Name = "Bob", Age = 25, Email = "*****@*****.**"
     }));
 }
Esempio n. 2
0
 public void Given_badEverything()
 {
     Assert.Equal("NameBetween1And50:Name;EmailMustContainAtChar:Email;AgeBetween0and120:Age", Validations.ToString(Validations.Validate(new Person {
         Name = "", Age = 150, Email = "bademail"
     })));
 }
Esempio n. 3
0
 public void Given_badAge()
 {
     Assert.Equal("AgeBetween0and120:Age", Validations.ToString(Validations.Validate(new Person {
         Name = "Bob", Age = 150, Email = "*****@*****.**"
     })));
 }
Esempio n. 4
0
 public void Given_badEmail()
 {
     Assert.Equal("EmailMustContainAtChar:Email", Validations.ToString(Validations.Validate(new Person {
         Name = "Bob", Age = 25, Email = "bademail"
     })));
 }
Esempio n. 5
0
 public void Given_badName()
 {
     Assert.Equal("NameBetween1And50:Name", Validations.ToString(Validations.Validate(new Person {
         Name = "", Age = 25, Email = "*****@*****.**"
     })));
 }
Esempio n. 6
0
 public void Given_badBooking()
 {
     Assert.Equal("DescriptionBetween1And50:Bookings[0].Description", Validations.ToString(Validations.Validate(
                                                                                               new Person {
         Name = "Bob", Age = 25, Email = "*****@*****.**", Bookings = { new Booking {
                                                                           Description = ""
                                                                       } }
     })));
 }