// get a web-request ready for interaction with test-rail server private T HttpExecutor <T>(TestRailHttpCommand command) { // get response body var response = GetWebResponse(command); var responseBody = response?.ReadBody(); if (responseBody == null) { return(default);
// gets all projects from the current server connection private IEnumerable <TestRailProject> GetProjects() { var command = new TestRailHttpCommand { Endpoint = ApiCommands.GET_PROJECTS, HttpMethod = "GET" }; var responseBody = HttpExecutor(command); return(JsonConvert.DeserializeObject <TestRailProject[]>(responseBody)); }
private void Post(string command, object data) { // create command var httpCommand = new TestRailHttpCommand { Endpoint = command, HttpMethod = HttpMethod.Post.Method, Data = data }; // execute command HttpExecutor(httpCommand); logger?.InfoFormat(CommandFormat, httpCommand?.Endpoint); }
private void Post(string command, object data) { // create command var httpCommand = new TestRailHttpCommand { Endpoint = command, HttpMethod = HttpMethod.Post.Method, Data = data }; // execute command HttpExecutor(httpCommand); Trace.TraceInformation(string.Format(COMMAND_MESSAGE, httpCommand?.Endpoint)); }
/// <summary> /// Send a GET request to the specified Uri /// </summary> /// <typeparam name="T">Type of the expected result object</typeparam> /// <param name="command">The Uri the request is sent to</param> /// <returns>Data Transfer Object(s) (DTO) of the requests type</returns> internal T ExecuteGet <T>(string command) { // create command var httpCommand = new TestRailHttpCommand { Endpoint = command }; // execute command var entities = HttpExecutor <T>(httpCommand); logger?.InfoFormat(CommandFormat, httpCommand?.Endpoint); // return entity return(entities); }
/// <summary> /// Send a GET request to the specified Uri /// </summary> /// <typeparam name="T">Type of the expected result object</typeparam> /// <param name="command">The Uri the request is sent to</param> /// <returns>Data Transfer Object(s) (DTO) of the requests type</returns> internal T ExecuteGet <T>(string command) { // create command var httpCommand = new TestRailHttpCommand { Endpoint = command }; // execute command var entities = HttpExecutor <T>(httpCommand); Trace.TraceInformation(string.Format(COMMAND_MESSAGE, httpCommand?.Endpoint)); // return entity return(entities); }
private T Post <T>(string command, object data) { // create command var httpCommand = new TestRailHttpCommand { Endpoint = command, HttpMethod = HttpMethod.Post.Method, Data = data }; // execute command var entities = HttpExecutor <T>(httpCommand); logger?.InfoFormat(CommandFormat, httpCommand?.Endpoint); // return entity return(entities); }
private T Post <T>(string command, object data) { // create command var httpCommand = new TestRailHttpCommand { Endpoint = command, HttpMethod = HttpMethod.Post.Method, Data = data }; // execute command var entities = HttpExecutor <T>(httpCommand); Trace.TraceInformation(string.Format(COMMAND_MESSAGE, httpCommand?.Endpoint)); // return entity return(entities); }