public void SerializeRequestsWhenCollectionIsNull()
        {
            var jrs = new JsonRpcSerializer();

            Assert.ThrowsException <ArgumentNullException>(() =>
                                                           jrs.SerializeRequests(null));
        }
Example #2
0
        public void CoreSerializeRequestsWhenCollectionIsNull()
        {
            var jsonRpcSerializer = new JsonRpcSerializer();

            Assert.Throws <ArgumentNullException>(() =>
                                                  jsonRpcSerializer.SerializeRequests(null));
        }
Example #3
0
        public void CoreSerializeRequestsWhenCollectionContainsNull()
        {
            var jsonRpcSerializer = new JsonRpcSerializer();

            var exception = Assert.Throws <JsonRpcException>(() =>
                                                             jsonRpcSerializer.SerializeRequests(new JsonRpcRequest[] { null }));

            Assert.Equal(JsonRpcErrorCodes.InvalidMessage, exception.ErrorCode);
        }
        public void SerializeRequestsWhenCollectionContainsNull()
        {
            var jrs = new JsonRpcSerializer();

            var exception = Assert.ThrowsException <JsonRpcSerializationException>(() =>
                                                                                   jrs.SerializeRequests(new JsonRpcRequest[] { null }));

            Assert.AreEqual(JsonRpcErrorCode.InvalidMessage, exception.ErrorCode);
        }
Example #5
0
        public void CoreSerializeRequestsToStreamWhenStreamIsNull()
        {
            var jsonRpcSerializer = new JsonRpcSerializer();
            var jsonRpcMessage1   = new JsonRpcRequest("m", 0L);
            var jsonRpcMessage2   = new JsonRpcRequest("m", 1L);
            var jsonRpcMessages   = new[] { jsonRpcMessage1, jsonRpcMessage2 };

            Assert.Throws <ArgumentNullException>(() =>
                                                  jsonRpcSerializer.SerializeRequests(jsonRpcMessages, null));
        }
Example #6
0
        public void CoreSerializeRequestsToStreamWhenRequestsIsNull()
        {
            var jsonRpcSerializer = new JsonRpcSerializer();
            var jsonRpcMessage    = new JsonRpcRequest("m", 0L);

            using (var jsonStream = new MemoryStream())
            {
                Assert.Throws <ArgumentNullException>(() =>
                                                      jsonRpcSerializer.SerializeRequests(null, jsonStream));
            }
        }
Example #7
0
        public void CoreSerializeRequestsToStream()
        {
            var jsonSample        = EmbeddedResourceManager.GetString("Assets.v2_core_batch_req.json");
            var jsonRpcSerializer = new JsonRpcSerializer();
            var jsonRpcMessage1   = new JsonRpcRequest("m", 0L);
            var jsonRpcMessage2   = new JsonRpcRequest("m", 1L);
            var jsonRpcMessages   = new[] { jsonRpcMessage1, jsonRpcMessage2 };

            using (var jsonStream = new MemoryStream())
            {
                jsonRpcSerializer.SerializeRequests(jsonRpcMessages, jsonStream);

                var jsonResult = Encoding.UTF8.GetString(jsonStream.ToArray());

                CompareJsonStrings(jsonSample, jsonResult);
            }
        }
Example #8
0
 public void SerializeRequestsWhenIdIsEmptyAndParametersAreByName()
 {
     _serializer.SerializeRequests(_requests["req_nul_nam"]);
 }
 public object SerializeRequestB1I1P0()
 {
     return(_serializer.SerializeRequests(_reqsb1["req_b1i1p0"]));
 }
Example #10
0
 public object BatchParamsNoneSerializeRequest()
 {
     return(_serializer.SerializeRequests(_requestBatches["request_params_none"]));
 }