protected void DoTest(TMemberInfo info) { var data = codec.EncodeSingle(info); var decoded = codec.DecodeSingle(data); Assert.That(decoded, Is.EqualTo(info)); }
public async Task <Response> Process(Request request) { try { logger.IncomingRequest(request); var startTime = DateTime.Now; var implementationInfo = serviceImplementationContainer.GetImplementation(request.Path.ServiceName, request.ServiceScope); var methodHandler = handlerContainer.GetHandler(implementationInfo.Description, request.Path); var responseData = await methodHandler.Handle(implementationInfo.Implementation, request.Data, 0); var executionTime = DateTime.Now - startTime; logger.ProcessedRequestSuccessfully(request, executionTime); return(new Response(ResponseStatus.Ok, responseData)); } catch (ServiceNotReadyException) { logger.ProcessNotReady(request); return(Response.NotReady); } catch (ServiceNotFoundException) { logger.ProcessedRequestWithBadStatus(request, ResponseStatus.ServiceNotFound); return(Response.NotFound); } catch (InvalidPathException) { logger.ProcessedRequestWithBadStatus(request, ResponseStatus.BadRequest); return(Response.BadRequest); } catch (InvalidImplementationException) { logger.ProcessedRequestWithBadStatus(request, ResponseStatus.InvalidImplementation); return(Response.InvalidImplementation); } catch (Exception ex) { logger.ProcessedRequestWithException(request, ex); var responseData = exceptionCodec.EncodeSingle(ex); return(new Response(ResponseStatus.Exception, responseData)); } }