public void ValidMethodOK() { clsMember AMember = new clsMember(); string Error = ""; Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); Assert.AreEqual(Error, ""); }
public void PhoneNumberNotBlank() { clsMember AMember = new clsMember(); String Error = ""; string PhoneNumber = ""; Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); Assert.AreNotEqual(Error, ""); }
public void PhoneNumberMaxMinusOne() { clsMember AMember = new clsMember(); String Error = ""; string PhoneNumber = "AAAAAAAAAAAAAA"; Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); Assert.AreEqual(Error, ""); }
public void AddressExtremeMax() { clsMember AMember = new clsMember(); String Error = ""; string Address = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); Assert.AreNotEqual(Error, ""); }
public void AddressMinBoundary() { clsMember AMember = new clsMember(); String Error = ""; string Address = "AAAAAAAAAA"; Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); Assert.AreEqual(Error, ""); }
public void DOBInvalidData() { clsMember AMember = new clsMember(); String Error = ""; String DOB = "this is not a date!"; Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); Assert.AreNotEqual(Error, ""); }
public void FullNameContainsSpace() { clsMember AMember = new clsMember(); String Error = ""; String FullName = "AAAAAAAAAAAAAAAAAAAA"; Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); Assert.AreNotEqual(Error, ""); }
public void FullNameExtremeMin() { clsMember AMember = new clsMember(); String Error = ""; String FullName = ""; Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); Assert.AreNotEqual(Error, ""); }
public void AddressMaxBoundary() { clsMember AMember = new clsMember(); String Error = ""; string Address = ""; Address = Address.PadRight(50, 'a'); Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); Assert.AreEqual(Error, ""); }
public void FullNamExtremeMax() { clsMember AMember = new clsMember(); String Error = ""; String FullName = ""; FullName = FullName.PadRight(100, 'A') + ""; Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); Assert.AreNotEqual(Error, ""); }
protected void bttnOK_Click(object sender, EventArgs e) { //create a new instance of clsMember clsMember AMember = new clsMember(); //capture all data for validation string FullName = txtbxFullName.Text; string Address = txtbxAddress.Text; string DOB = txtbxDOB.Text; string PhoneNumber = txtbxPhoneNumber.Text; //variable to store error messages string Error = ""; Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); if (Error == "") { //capture all the data AMember.MemberID = MemberID; AMember.FullName = FullName; AMember.Address = Address; AMember.DOB = Convert.ToDateTime(DOB); AMember.PhoneNumber = PhoneNumber; AMember.MedicalConditions = chkbxMedicalConditions.Checked; //create a new instance of the Member collection clsMemberCollection AllMembers = new clsMemberCollection(); //if this is a new record then add the data if (MemberID == -1) { //set the ThisMember property AllMembers.ThisMember = AMember; //add the new record AllMembers.Add(); } else //otherwise it must be an update { //find the record to update AllMembers.ThisMember.Find(MemberID); //set the ThisMember property AllMembers.ThisMember = AMember; //update the record AllMembers.Update(); } //redirect back to the listpage Response.Redirect("MemberList.aspx"); } else { lblErrorMessage.Text = Error; } }
public void DOBExtremeMax() { clsMember AMember = new clsMember(); String Error = ""; DateTime TestDate; TestDate = DateTime.Now.Date; string DOB = TestDate.AddYears(100).ToString(); Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); Assert.AreNotEqual(Error, ""); }
public void DOBMaxMinusOne() { clsMember AMember = new clsMember(); String Error = ""; DateTime TestDate; TestDate = DateTime.Now.Date; string DOB = TestDate.AddYears(-18).AddDays(-1).ToString(); Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); Assert.AreEqual(Error, ""); }