示例#1
0
 public void Given_validPerson()
 {
     Assert.Empty(Validations.Validate(new Person {
         Name = "Bob", Age = 25, Email = "*****@*****.**"
     }));
 }
示例#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"
     })));
 }
示例#3
0
 public void Given_badAge()
 {
     Assert.Equal("AgeBetween0and120:Age", Validations.ToString(Validations.Validate(new Person {
         Name = "Bob", Age = 150, Email = "*****@*****.**"
     })));
 }
示例#4
0
 public void Given_badEmail()
 {
     Assert.Equal("EmailMustContainAtChar:Email", Validations.ToString(Validations.Validate(new Person {
         Name = "Bob", Age = 25, Email = "bademail"
     })));
 }
示例#5
0
 public void Given_badName()
 {
     Assert.Equal("NameBetween1And50:Name", Validations.ToString(Validations.Validate(new Person {
         Name = "", Age = 25, Email = "*****@*****.**"
     })));
 }
示例#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 = ""
                                                                       } }
     })));
 }