private void TestCallback (RogerthatCallbackApiHandler handler, string apiMethod, string subType) { CultureInfo usCulture = new CultureInfo ("en-US"); Thread.CurrentThread.CurrentCulture = usCulture; IDictionary<String, object> jsonRpcData = RogerthatCallbackApiHandler.ReadJsonRpcData (GetInputStream (apiMethod, subType)); string requestId = (string)jsonRpcData ["id"]; Assert.IsNotNull (requestId); Assert.IsNotEmpty (requestId); string requestMethod = (string)jsonRpcData ["method"]; Assert.AreEqual (apiMethod, requestMethod); IDictionary<string, object> requestParameters = (IDictionary<string, object>)jsonRpcData ["parameters"]; Assert.IsNotNull (requestParameters); Response result = handler.ExecuteMethod (requestMethod, requestParameters); Assert.IsNotNull (result); // Check if response is valid json. An improvement would be to add result json.txt files for all callbacks, but we have too much work at this moment. using (Stream memoryStream = new MemoryStream ()) { using (StreamWriter sw = new StreamWriter (memoryStream)) { handler.WriteResponse (requestId, result, null, sw); sw.Flush (); memoryStream.Seek (0, SeekOrigin.Begin); RogerthatCallbackApiHandler.ReadJsonRpcData (memoryStream); } } }