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