public void TestDeleteMappingRequestSuccess() { //Obtain Mapping ID from Inquire Mapping test results. deleteOptions.MappingId = inquireMapping.Mappings[0].MappingId; DeleteMapping deleteMapping = service.GetDeleteMapping(deleteOptions); Assert.IsTrue(deleteMapping != null); Assert.IsTrue(deleteMapping.RequestId != null && deleteMapping.RequestId > 0); Assert.IsTrue(deleteMapping.Mapping.MappingId != null && deleteMapping.Mapping.MappingId > 0); }
public static void RunWith(HttpListenerContext context) { string path = context.Request.Url.PathAndQuery; string httpMethod = context.Request.HttpMethod; try { HttpMethod method = (HttpMethod)Enum.Parse(typeof(HttpMethod), httpMethod, true); switch (method) { case HttpMethod.GET: GetResponse(GetMapping.FindPath(path, method, context), context); break; case HttpMethod.POST: GetResponse(PostMapping.FindPath(path, method, context), context); break; case HttpMethod.DELETE: GetResponse(DeleteMapping.FindPath(path, method, context), context); break; case HttpMethod.PUT: GetResponse(PutMapping.FindPath(path, method, context), context); break; case HttpMethod.PATCH: GetResponse(PatchMapping.FindPath(path, method, context), context); break; case HttpMethod.OPTIONS: var requestedMethod = Enum.Parse <HttpMethod>(context.Request.Headers.Get("Access-Control-Request-Method")); var requestedHeaders = context.Request.Headers.Get("Access-Control-Request-Headers"); var response = AbstractMapping.HandleOptionsRequest(path, requestedMethod, requestedHeaders); SendResponse(response, context); break; default: throw new ServerRequestMethodNotSupportedException($"{httpMethod} is not supported", context); } } catch (ServerRequestMethodNotSupportedException ex) { ExceptionHandler.HandleException(ex, context); } catch (ServerEndpointNotValidException ex) { ExceptionHandler.HandleException(ex, context); } catch (Exception ex) { try { throw new InternalServerErrorException(ex.Message, context, ex); } catch (InternalServerErrorException e) { ExceptionHandler.HandleException(e, context); } } }