[TestMethod] // Check if Email is in correct format public void Check_ValidEmail() { Validators objVal = new Validators(); BusinessComponents.CreateJob obj = new BusinessComponents.CreateJob(); string email = "*****@*****.**"; NUnit.Framework.Assert.AreEqual(objVal.emailIsValid(email), true); }
[TestMethod] // Check Contact Number is not null or empty in 'Create Job' page. public void Invalid_When_contactNum_Is_Null() { Validators objVal = new Validators(); BusinessComponents.CreateJob obj = new BusinessComponents.CreateJob(); obj.jobName = "Cleaning"; obj.jobType = "Part-time"; obj.contactEmail = "*****@*****.**"; NUnit.Framework.Assert.AreEqual(objVal.checkRequiredFields(obj), false); }
[TestMethod] // Check Job Name is not null or empty in 'Create Job' page. public void Invalid_When_JobName_Is_Null() { DataAccessLayer.Validators objVal = new DataAccessLayer.Validators(); BusinessComponents.CreateJob obj = new BusinessComponents.CreateJob(); obj.jobType = "Part-time"; obj.contactEmail = "*****@*****.**"; obj.contactNum = "07897889009"; obj.jobName = ""; NUnit.Framework.Assert.AreEqual(objVal.checkRequiredFields(obj), false); }
protected void Create_Click(object sender, EventArgs e) { BusinessComponents.CreateJob obj = new BusinessComponents.CreateJob(); obj.address = txtAddress.Text.ToString(); obj.contactEmail = txtEmail.Text.ToString(); obj.contactNum = txtContactNo.Text.ToString(); obj.JobDescription = txtJobDesc.Text.ToString(); obj.jobName = txtJobName.Text.ToString(); obj.jobType = ddlJobType.SelectedValue.ToString(); obj.salary = Convert.ToInt32(txtSalary.Text); obj.CreateNewJob(obj); ClearFields(); }
[TestMethod] //Check if job details get saved to the database public void CreateJobTest() { bool expected = true; DataAccessLayer.Job objCJ = new DataAccessLayer.Job(); BusinessInterfaces.ICreateJob obj = new BusinessComponents.CreateJob(); obj.address = "test"; obj.contactEmail = "rwser"; obj.contactNum = "0787566767"; obj.JobDescription = "test desc"; obj.jobName = "Cleaning"; obj.jobType = "Permanent"; obj.salary = 123; bool result = objCJ.createNewJob(obj); NUnit.Framework.Assert.AreEqual(expected, result); }