public async Task TestPersonER_New() { var person = await PersonER.NewPersonER(); Assert.NotNull(person); Assert.False(person.IsValid); }
public async Task TestPersonER_TestInvalidSave() { var person = await PersonER.NewPersonER(); await BuildPerson(person); person.LastName = string.Empty; Assert.False(person.IsValid); await Assert.ThrowsAsync <ValidationException>(() => person.SaveAsync()); }
public async void TestPersonER_Insert() { var person = await PersonER.NewPersonER(); await BuildPerson(person); var savedPerson = await person.SaveAsync(); Assert.NotNull(savedPerson); Assert.IsType <PersonER>(savedPerson); Assert.True(savedPerson.Id > 0); Assert.NotNull(savedPerson.RowVersion); }
public async Task TestPersonER_LastNameRequired() { var person = await PersonER.NewPersonER(); await BuildPerson(person); var isObjectValidInit = person.IsValid; person.LastName = string.Empty; Assert.NotNull(person); Assert.True(isObjectValidInit); Assert.False(person.IsValid); Assert.Equal("LastName", person.BrokenRulesCollection[0].OriginProperty); }
public async Task TestPersonER_PersonAddressMaxLengthLessThan50() { var personType = await PersonER.NewPersonER(); await BuildPerson(personType); var isObjectValidInit = personType.IsValid; personType.LastName = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor " + "incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis " + "nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. " + "Duis aute irure dolor in reprehenderit"; Assert.NotNull(personType); Assert.True(isObjectValidInit); Assert.False(personType.IsValid); Assert.Equal("LastName", personType.BrokenRulesCollection[0].OriginProperty); }