public void TestUploadFile() { // Catches exceptions thrown from any class or method try { // Navigates to a country's job vacancies, South Africa, in this case CountrySelection.Execute(); test.Pass("Country selection for available jobs successful"); // Selects Job posts, only the first one in the list in this case JobPostSelection.Execute(); test.Pass("job post selection successful"); // Implements the job application process of filling the application form // Retrieves user information from excel data sheet to fill the application JobApplication.Execute(TestCaseRow); test.Pass("job application successful"); // Validates whether the test case passes or fails based on the error message returned Validation.Execute(); // Passes or fails the test from the set test result value // test result value is insert or updated in the excel data sheet if (BaseClass.TestResult == true) { // If the value of test results is True, then test is complete - pass ExcelDataIO.WriteData("Pass", TestCaseRow, Constant.COLUMN_RESULT); } else { // If the value of test results is False, then test is complete - fail // Throws exception in case of a fail, caught by catch block below throw new Exception("Test Case Failed - Validation failed"); } } catch (Exception e) { // If in case you got any exception during the test, it will mark your test as Fail in the test result sheet ExcelDataIO.WriteData("Fail", TestCaseRow, Constant.COLUMN_RESULT); // This will print the error log message Log.Error(e.Message); test.Log(Status.Error, e.Message); // Exception to fail the test completely in the NUnit results throw e; } }
/// <summary> /// Public member for creating a list of subregions. /// </summary> /// <param name="selection">The country or countries that define the desired subregions.</param> /// <returns>A generic List of Subregions.</returns> /// <remarks> /// More that one country may be returned by using the bitwise OR operator. /// </remarks> public static List <SubRegion> Make(CountrySelection selection) { var results = new List <SubRegion>(); if (selection.HasFlag(CountrySelection.Canada)) { results.AddRange(MakeCanadianProvinces()); } if (selection.HasFlag(CountrySelection.UnitedStates)) { results.AddRange(MakeUSStates()); } if (results.Count == 0) { throw new System.NotImplementedException("The country selection has not been implemented."); } return(results); }
/// <summary> /// Public member for creating a list of subregions. /// </summary> /// <param name="selection">The country or countries that define the desired subregions.</param> /// <returns>A generic List of Subregions.</returns> /// <remarks> /// More that one country may be returned by using the bitwise OR operator. /// </remarks> public static List<SubRegion> Make(CountrySelection selection) { var results = new List<SubRegion>(); if (selection.HasFlag(CountrySelection.Canada)) { results.AddRange(MakeCanadianProvinces()); } if (selection.HasFlag(CountrySelection.UnitedStates)) { results.AddRange(MakeUSStates()); } if (results.Count == 0) { throw new System.NotImplementedException("The country selection has not been implemented."); } return results; }