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