Exemplo n.º 1
0
        public string ProcessRequest(string request)
        {
            var    jsonRequest = JsonRequest.Parse(request);
            object response    = InvokeMethod(jsonRequest.MethodName, jsonRequest.DeserializedArgs);

            return(JsonResponse.SerializeResponse(response));
        }
Exemplo n.º 2
0
        public void Parse_DeseralizeException_ThrowsParseException()
        {
            var invalid_json = "invalid json";
            var response     = new NetworkResponse
            {
                Data    = Encoding.UTF8.GetBytes(invalid_json),
                Headers = new WebHeaderCollection(),
            };

            _mock_serializer.
            Setup(m => m.Deserialize <int>(invalid_json)).
            Throws <SerializationException>();

            Xunit.Assert.Throws <ParseException>(() =>
                                                 _request.Parse(response));
        }