public async void MemberInfoER_GetNewObject() { var memberInfo = await MemberInfoER.NewMemberInfoER(); Assert.NotNull(memberInfo); Assert.False(memberInfo.IsValid); }
public async Task MemberInfoER_TestInvalidSave() { var memberInfo = await MemberInfoER.NewMemberInfoER(); memberInfo.MemberNumber = String.Empty; Assert.False(memberInfo.IsValid); Assert.Throws <Csla.Rules.ValidationException>(() => memberInfo.Save()); }
public async Task MemberInfoER_DeleteObjectFromDatabase() { const int ID_TO_DELETE = 99; await MemberInfoER.DeleteMemberInfoER(ID_TO_DELETE); var categoryToCheck = await Assert.ThrowsAsync <Csla.DataPortalException> (() => MemberInfoER.GetMemberInfoER(ID_TO_DELETE)); }
public async void MemberInfoER_Get() { var memberInfo = await MemberInfoER.GetMemberInfoER(1); Assert.NotNull(memberInfo.Person); Assert.NotNull(memberInfo.MembershipType); Assert.NotNull(memberInfo.MemberStatus); Assert.NotNull(memberInfo.PrivacyLevel); Assert.Equal(1, memberInfo.Id); Assert.True(memberInfo.IsValid); }
public async Task MemberInfoER_InsertNewObjectIntoDatabase() { var memberInfo = await MemberInfoER.NewMemberInfoER(); await BuildMemberInfoER(memberInfo); var savedMemberInfo = await memberInfo.SaveAsync(); Assert.NotNull(savedMemberInfo); Assert.IsType <MemberInfoER>(savedMemberInfo); Assert.True(savedMemberInfo.Id > 0); }
public async void MemberInfoER_UpdateExistingObjectInDatabase() { var newMemberNumber = "1234567890"; var memberInfo = await MemberInfoER.GetMemberInfoER(1); memberInfo.MemberNumber = newMemberNumber; var result = await memberInfo.SaveAsync(); Assert.NotNull(result); Assert.Equal(newMemberNumber, result.MemberNumber); }
public async Task MemberInfoER_MemberNumberRequired() { var memberInfo = await MemberInfoER.NewMemberInfoER(); await BuildMemberInfoER(memberInfo); var isObjectValidInit = memberInfo.IsValid; memberInfo.MemberNumber = String.Empty; Assert.NotNull(memberInfo); Assert.True(isObjectValidInit); Assert.False(memberInfo.IsValid); }
public async Task TestMemberInfoER_LastUpdatedDateRequired() { var memberInfoToTest = await BuildMemberInfo(); var memberInfo = await MemberInfoER.GetMemberInfoER(1); var isObjectValidInit = memberInfo.IsValid; memberInfo.LastUpdatedDate = DateTime.MinValue; Assert.NotNull(memberInfo); Assert.True(isObjectValidInit); Assert.False(memberInfo.IsValid); Assert.Equal("LastUpdatedDate", memberInfo.BrokenRulesCollection[0].Property); Assert.Equal("LastUpdatedDate required", memberInfo.BrokenRulesCollection[0].Description); }
public async Task TestMemberInfoER_MembershipTypeRequired() { var memberInfoToTest = await BuildMemberInfo(); var memberInfo = await MemberInfoER.GetMemberInfoER(1); var isObjectValidInit = memberInfo.IsValid; memberInfo.MembershipType = null; Assert.NotNull(memberInfo); Assert.True(isObjectValidInit); Assert.False(memberInfo.IsValid); Assert.Equal("MembershipType", memberInfo.BrokenRulesCollection[0].Property); Assert.Equal("MembershipType required", memberInfo.BrokenRulesCollection[0].Description); }
private async Task BuildMemberInfoER(MemberInfoER memberInfo) { var domainInfo = await BuildMemberInfo(); memberInfo.Notes = domainInfo.Notes; memberInfo.Person = await PersonEC.GetPersonEC(domainInfo.Person); memberInfo.MemberNumber = domainInfo.MemberNumber; memberInfo.MembershipType = await MembershipTypeEC.GetMembershipTypeEC(domainInfo.MembershipType); memberInfo.MemberStatus = await MemberStatusEC.GetMemberStatusEC(domainInfo.MemberStatus); memberInfo.PrivacyLevel = await PrivacyLevelEC.GetPrivacyLevelEC(domainInfo.PrivacyLevel); memberInfo.DateFirstJoined = new SmartDate(DateTime.Now); memberInfo.LastUpdatedBy = domainInfo.LastUpdatedBy; memberInfo.LastUpdatedDate = domainInfo.LastUpdatedDate; }
public async Task MemberInfoER_MemberNumberExceedsMaxLengthOf35() { var memberInfo = await MemberInfoER.NewMemberInfoER(); await BuildMemberInfoER(memberInfo); Assert.True(memberInfo.IsValid); memberInfo.MemberNumber = "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 "; Assert.NotNull(memberInfo); Assert.False(memberInfo.IsValid); Assert.Equal("MemberNumber", memberInfo.BrokenRulesCollection[0].Property); Assert.Equal("MemberNumber can not exceed 35 characters", memberInfo.BrokenRulesCollection[0].Description); }
public async Task TestMemberInfoER_LastUpdatedByExceeds255Characters() { var memberInfoToTest = await BuildMemberInfo(); var memberInfo = await MemberInfoER.GetMemberInfoER(1); var isObjectValidInit = memberInfo.IsValid; memberInfo.LastUpdatedBy = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempo" + "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 in voluptate velit esse cillum dolore eu fugiat nulla pariatur."; Assert.NotNull(memberInfo); Assert.True(isObjectValidInit); Assert.False(memberInfo.IsValid); Assert.Equal("LastUpdatedBy", memberInfo.BrokenRulesCollection[0].Property); Assert.Equal("LastUpdatedBy can not exceed 255 characters", memberInfo.BrokenRulesCollection[0].Description); }