private ApiResponse <object> Response(ConfigurationServiceManager handler, Method method) { if (method == Method.Create) { return(handler.ConfigurationService <object>(DefaultParameters["service"], DefaultParameters["id"], DefaultParameters["body"], System.Net.Http.HttpMethod.Put)); } else { return(handler.ConfigurationService <object>(DefaultParameters["service"], DefaultParameters["id"], System.Net.Http.HttpMethod.Get)); } }
private void CreateConfigurationService(string service, string id, string body) { var handler = new ConfigurationServiceManager(); var response = handler.ConfigurationService <object>(service, id, body, System.Net.Http.HttpMethod.Put); PrAssume.That(response, PrIs.SuccessfulResponse()); }
public void ConfigurationServiceInvalidSpecialTest(InvalidSpecial inputType, Method method) { var request = GetParameters[inputType](method); var handler = new ConfigurationServiceManager(); ApiResponse <object> response = null; if (method == Method.Create) { var contentType = inputType == InvalidSpecial.WrongContentType ? "text/html" : "application/json"; response = handler.ConfigurationService <object>(request["service"], request["id"], request["body"], System.Net.Http.HttpMethod.Put, contentType); } else { response = handler.ConfigurationService <object>(request["service"], request["id"], System.Net.Http.HttpMethod.Get); } PrAssert.That(response, PrIs.ErrorResponse()); }
private void GetAndVerifyConfigurationService(string service, string id, string body) { var handler = new ConfigurationServiceManager(); var response = handler.ConfigurationService <object>(service, id, System.Net.Http.HttpMethod.Get); PrAssert.That(response, PrIs.SuccessfulResponse()); PrAssert.That(JObject.Parse(response.Result.ToString()), PrIs.EqualTo(JObject.Parse(body))); }
public void DuplicateParamenterConfigurationServiceTest(Method method, Parameters parameter, DuplicateValues duplicateValue) { var request = new Dictionary <string, string>(DefaultParameters); var handler = new ConfigurationServiceManager(); string bodyJson = DuplicateMapping[parameter](duplicateValue, request); var response = handler.ConfigurationService <object>(request["service"], request["id"], bodyJson, System.Net.Http.HttpMethod.Put); PrAssert.That(response, PrIs.ErrorResponse()); }
public void VerifyContentTypeTest(Method method) { var handler = new ConfigurationServiceManager(); var request = new Dictionary <string, string>(DefaultParameters); ApiResponse <object> response = null; if (method == Method.Create) { response = handler.ConfigurationService <object>(request["service"], request["id"], request["body"], System.Net.Http.HttpMethod.Put); } else { response = handler.ConfigurationService <object>(request["service"], request["id"], System.Net.Http.HttpMethod.Get); } PrAssert.That(response, PrIs.SuccessfulResponse()); PrAssert.That(response.ContentType, PrIs.Not.Null); PrAssert.That(response.ContentType.MediaType, method == Method.Get ? PrIs.EqualTo("application/json") : PrIs.EqualTo("text/html")); }
public void ConfigurationServiceValidCreateTest(Parameters parameter, Valid inputType) { var handler = new ConfigurationServiceManager(); var request = new Dictionary <string, string>(DefaultParameters); request[parameter.ToString().ToLower()] = ValidCreateMapping[inputType]; var response = handler.ConfigurationService <object>(request["service"], request["id"], request["body"], System.Net.Http.HttpMethod.Put); PrAssert.That(response, PrIs.SuccessfulResponse()); PrAssert.That(response.Result, PrIs.Null); }
public void CreateConfigurationServiceByOtherHttpMethod(HttpMethod inputType) { var handler = new ConfigurationServiceManager(); var request = new Dictionary <string, string>(DefaultParameters); var httpMethod = new Dictionary <HttpMethod, System.Net.Http.HttpMethod>() { [HttpMethod.GET] = System.Net.Http.HttpMethod.Get, [HttpMethod.DELETE] = System.Net.Http.HttpMethod.Delete, [HttpMethod.POST] = System.Net.Http.HttpMethod.Post, }; var response = handler.ConfigurationService <object>(request["service"], request["id"], request["body"], httpMethod[inputType]); PrAssert.That(response, PrIs.ErrorResponse()); }