예제 #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 = ""
                                                                       } }
     })));
 }