private static void runTest(TestCase testCase) { var queryParam = new ApiList(); foreach (var param in testCase.QueryParams) { queryParam.Add(param); } string queryString = queryParam.ToQueryString(); LoggerManager.Logger.LogInformation($"Test Case {testCase.Name} started. Query string: {queryString}"); Console.WriteLine($"Test Case {testCase.Name} started."); // base URL string baseUrl; //static string apiPath = "test/l2-eg/v1"; //according to "EDH_BIDWH_HPB_UAT_REST_Scenarios_Conditions_v1.0.xlsx", tab "WebService" //v1/entities //v1/entity/{uen} //v1/entity/{uen}/appointments string fullPath; switch (testCase.TestMethod) { case TestMethod.Entities: fullPath = $"{apiPath}/entities"; break; case TestMethod.UENs: fullPath = $"{apiPath}/entity/{testCase.UEN}"; break; case TestMethod.Appointments: default: fullPath = $"{apiPath}/entity/{testCase.UEN}/appointments"; break; } if (string.IsNullOrEmpty(queryString)) { baseUrl = $"https://{signingGateway}/{fullPath}"; } else { baseUrl = $"https://{signingGateway}/{fullPath}?{queryString}"; } // authorization header var authorizationHeader = ApiAuthorization.Token(realm, authPrefix, HttpMethod.GET, new Uri(baseUrl), appId, null, null, privateKey); //target base URL string targetBaseUrl; if (string.IsNullOrEmpty(queryString)) { targetBaseUrl = $"https://{targetGatewayName}/{fullPath}"; } else { targetBaseUrl = $"https://{targetGatewayName}/{fullPath}?{queryString}"; } var result = ApiAuthorization.HttpRequest(new Uri(targetBaseUrl), authorizationHeader); LoggerManager.Logger.LogInformation($"Test Case {testCase.Name} ended with result: {result}"); Console.WriteLine($"Test Case {testCase.Name} ended with result: {result}"); }