public void Add_New_Applicant( string sureName, string middleName, string foreName, string gender, string dateOfBirth, string enrolmentStatus, string Class, string attendanceMode, string boarderStatus) { #region PRE-CONDITIONS: var schoolIntakeId = Guid.NewGuid(); const string admissionTerm = "Spring"; const int numberOfPlannedAdmission = 31; const int capacity = 10; var admissionYear = String.Format("{0}/{1}", (DateTime.Now.Year), (DateTime.Now.Year + 1)); var dateOfAdmission = new DateTime(DateTime.Today.Year, 8, 8); var admissionGroupName = Utilities.GenerateRandomString(10, "TC_AG01_Data"); var yearGroup = Queries.GetFirstYearGroup(); var dataPackage = this.BuildDataPackage(); dataPackage.AddSchoolIntake( schoolIntakeId, admissionYear, admissionTerm, yearGroup, numberOfPlannedAdmission, admissionGroupName, dateOfAdmission, capacity); // Act using (new DataSetup(purgeBeforeInsert: false, purgeAfterTest: true, packages: dataPackage)) { // Login as Admission SeleniumHelper.Login(SeleniumHelper.iSIMSUserType.AdmissionsOfficer); // Navigate to Application page AutomationSugar.NavigateMenu("Tasks", "Admissions", "Applications"); Wait.WaitForAjaxReady(); var applicantTriplet = new ApplicationTriplet(); // Search to change to Admitted if existing Applicant applicantTriplet.SearchCriteria.SetStatus("Applied", true); applicantTriplet.SearchCriteria.SetStatus("Offered", true); applicantTriplet.SearchCriteria.SetStatus("Accepted", true); applicantTriplet.SearchCriteria.SearchByName = sureName; var searchResults = applicantTriplet.SearchCriteria.Search(); var applicantTile = searchResults.SingleOrDefault(t => t.Code.Equals(sureName + ", " + foreName)); applicantTriplet.ChangeToAdmit(applicantTile); #endregion #region STEPS: // Create new an Applicant applicantTriplet = new ApplicationTriplet(); var addNewApplicationDialog = applicantTriplet.AddNewApplicationDialog(); addNewApplicationDialog.ForeName = foreName; addNewApplicationDialog.MiddleName = middleName; addNewApplicationDialog.SureName = sureName; addNewApplicationDialog.Gender = gender; addNewApplicationDialog.DateofBirth = dateOfBirth; addNewApplicationDialog.Continue(); // Navigate to Registration Details dialog var registrationDetailsDialog = new RegistrationDetailsDialog(); registrationDetailsDialog.AdmissionGroup = admissionGroupName; registrationDetailsDialog.EnrolmentStatus = enrolmentStatus; registrationDetailsDialog.Class = Class; registrationDetailsDialog.AttendanceMode = attendanceMode; registrationDetailsDialog.BoarderStatus = boarderStatus; registrationDetailsDialog.AddRecord(); // Search Applicant that has just created applicantTriplet.SearchCriteria.SearchByName = sureName; searchResults = applicantTriplet.SearchCriteria.Search(); applicantTile = searchResults.SingleOrDefault(t => t.Code.Equals(sureName + ", " + foreName)); try { // Verify that Applicant was created Assert.IsNotNull(applicantTile, "Application record not created"); var applicationPage = applicantTile.Click <ApplicationPage>(); // Verify that Applicant was created successfully Assert.AreEqual(foreName, applicationPage.LegalForeName, "Legal ForName is not equal"); Assert.AreEqual(sureName, applicationPage.LegalSureName, "Legal SurName is not equal"); Assert.AreEqual(gender, applicationPage.Gender, "Gender is not equal"); Assert.AreEqual(dateOfBirth, applicationPage.DateOfBirth, "Date of Birth is not equal"); Assert.AreEqual(dateOfBirth.GetMonthsAndYears(), applicationPage.Age, "Ages is not equal"); Assert.AreEqual("Applied", applicationPage.ApplicationStatus, "Application Status is not equal"); Assert.AreEqual(admissionGroupName, applicationPage.AdmissionGroup, "Admission Group is not equal"); Assert.AreEqual("", applicationPage.AdmissionNumber, "Admission Number is not equal"); Assert.AreEqual(true, applicationPage.VerifyDisable(), "Age and Age On Entry are not disabled"); } finally { // Tear down linked records before clean up var learnerId = Queries.GetLearnerId(sureName, foreName, dateOfBirth); var applicationId = Queries.GetApplicationId(learnerId); PurgeLinkedData.DeleteApplicationStatusLog(applicationId); PurgeLinkedData.DeleteApplication(applicationId); PurgeLinkedData.DeleteLearnerEnrolmentStatusForPupil(learnerId); PurgeLinkedData.DeleteLearnerEnrolmentForPupil(learnerId); PurgeLinkedData.DeleteNcYearMembershipForPupil(learnerId); PurgeLinkedData.DeleteYearGroupMembershipForPupil(learnerId); PurgeLinkedData.DeleteAttendanceModelForLearner(learnerId); PurgeLinkedData.DeleteBorderStatusForLearner(learnerId); PurgeLinkedData.DeletePrimaryClassMembershipForLearner(learnerId); PurgeLinkedData.DeletePupil(foreName, sureName); } } #endregion }
public void Admit_Applicant( string sureName, string middleName, string foreName, string gender, string dateOfBirth, string enrolmentStatus, string Class, string attendanceMode, string boarderStatus ) { var schoolIntakeId = Guid.NewGuid(); var admissionGroupId = Guid.NewGuid(); const string admissionTerm = "Spring"; const int numberOfPlannedAdmission = 31; const int capacity = 10; var admissionYear = string.Format("{0}/{1}", (DateTime.Now.Year), (DateTime.Now.Year + 1)); var dateOfAdmission = new DateTime(DateTime.Today.Year, 8, 8); var admissionGroupName = Utilities.GenerateRandomString(10, "TC_AG02_Data"); var yearGroup = Queries.GetFirstYearGroup(); var dataPackage = this.BuildDataPackage(); dataPackage.AddSchoolIntake( schoolIntakeId, admissionYear, admissionTerm, yearGroup, numberOfPlannedAdmission, admissionGroupName, dateOfAdmission, capacity, admissionGroupId); var pupilId = Guid.NewGuid(); var learnerEnrolmentId = Guid.NewGuid(); var applicantId = Guid.NewGuid(); var dob = new DateTime(2010, 01, 01); var pupilSurname = Utilities.GenerateRandomString(10, "TestPupil1_Surname" + Thread.CurrentThread.ManagedThreadId); var pupilForename = Utilities.GenerateRandomString(10, "TestPupil1_Forename" + Thread.CurrentThread.ManagedThreadId); dataPackage.AddBasicLearner(pupilId, pupilSurname, pupilForename, dob, new DateTime(2015, 09, 01), enrolStatus: "F", uniqueLearnerEnrolmentId: learnerEnrolmentId); dataPackage.AddBasicApplicant(applicantId, pupilId, learnerEnrolmentId, admissionGroupId, new DateTime(2015, 09, 01)); // Act using (new DataSetup(purgeBeforeInsert: false, purgeAfterTest: true, packages: dataPackage)) { // Login as Admission SeleniumHelper.Login(SeleniumHelper.iSIMSUserType.AdmissionsOfficer); // Navigate to Application page AutomationSugar.NavigateMenu("Tasks", "Admissions", "Applications"); Wait.WaitForAjaxReady(); var applicantTriplet = new ApplicationTriplet(); // Find the applicant applicantTriplet.SearchCriteria.SetStatus("Applied", true); applicantTriplet.SearchCriteria.SetStatus("Offered", true); applicantTriplet.SearchCriteria.SetStatus("Accepted", true); applicantTriplet.SearchCriteria.SearchByName = pupilSurname; var searchResults = applicantTriplet.SearchCriteria.Search(); var applicantTile = searchResults.SingleOrDefault(t => t.Code.Equals(pupilSurname + ", " + pupilForename)); try { //make sure applicant is found Assert.IsNotNull(applicantTile, "Application record not created"); //change status to admitted applicantTriplet.ChangeToAdmit(applicantTile); applicantTriplet.SearchCriteria.DisplayIfHidden(); // Verify that Applicant was admitted applicantTriplet.SearchCriteria.SetStatus("Applied", false); applicantTriplet.SearchCriteria.SetStatus("Offered", false); applicantTriplet.SearchCriteria.SetStatus("Accepted", false); applicantTriplet.SearchCriteria.SetStatus("Reserved", false); applicantTriplet.SearchCriteria.SetStatus("Admitted", true); applicantTriplet.SearchCriteria.SearchByName = pupilSurname; searchResults = applicantTriplet.SearchCriteria.Search(); applicantTile = searchResults.SingleOrDefault(t => t.Code.Equals(pupilSurname + ", " + pupilForename)); Assert.IsNotNull(applicantTile, "Application record not admitted"); var applicationPage = applicantTile.Click <ApplicationPage>(); Assert.AreEqual("Admitted", applicationPage.ApplicationStatus, "Application Status is not equal"); } finally { // Tear down linked records before clean up var learnerId = Queries.GetLearnerId(pupilSurname, pupilForename, dob.ToLongDateString()); var applicationId = Queries.GetApplicationId(learnerId); PurgeLinkedData.DeleteApplicationStatusLog(applicationId); PurgeLinkedData.DeleteApplication(applicationId); PurgeLinkedData.DeleteLearnerEnrolmentStatusForPupil(learnerId); PurgeLinkedData.DeleteLearnerEnrolmentForPupil(learnerId); PurgeLinkedData.DeleteNcYearMembershipForPupil(learnerId); PurgeLinkedData.DeleteYearGroupMembershipForPupil(learnerId); PurgeLinkedData.DeleteAttendanceModelForLearner(learnerId); PurgeLinkedData.DeleteBorderStatusForLearner(learnerId); PurgeLinkedData.DeletePrimaryClassMembershipForLearner(learnerId); PurgeLinkedData.DeletePupil(foreName, sureName); } } }