Ejemplo n.º 1
0
        public async Task SerializeRequestAsyncWhenRequestIsNull()
        {
            var jrs = new JsonRpcSerializer();

            await Assert.ThrowsExceptionAsync <ArgumentNullException>(() =>
                                                                      jrs.SerializeRequestAsync(null, default).AsTask());
        }
Ejemplo n.º 2
0
        public async Task SerializeRequestAsyncWithStreamWhenStreamIsNull()
        {
            var jrs = new JsonRpcSerializer();
            var jrm = new JsonRpcRequest(0L, "m");

            await Assert.ThrowsExceptionAsync <ArgumentNullException>(() =>
                                                                      jrs.SerializeRequestAsync(jrm, (Stream)null, default).AsTask());
Ejemplo n.º 3
0
        public async void CoreSerializeRequestAsyncToStreamWhenStreamIsNull()
        {
            var jsonRpcSerializer = new JsonRpcSerializer();
            var jsonRpcMessage    = new JsonRpcRequest("m", 0L);

            await Assert.ThrowsAsync <ArgumentNullException>(() =>
                                                             jsonRpcSerializer.SerializeRequestAsync(jsonRpcMessage, null));
        }
Ejemplo n.º 4
0
        public async Task SerializeRequestAsyncWithStreamWhenRequestIsNull()
        {
            var jrs = new JsonRpcSerializer();

            using var stream = new MemoryStream();

            await Assert.ThrowsExceptionAsync <ArgumentNullException>(() =>
                                                                      jrs.SerializeRequestAsync(null, stream, default).AsTask());
        }
Ejemplo n.º 5
0
        public async void CoreSerializeRequestAsyncToStreamWhenRequestIsNull()
        {
            var jsonRpcSerializer = new JsonRpcSerializer();
            var jsonRpcMessage    = new JsonRpcRequest("m", 0L);

            using (var jsonStream = new MemoryStream())
            {
                await Assert.ThrowsAsync <ArgumentNullException>(() =>
                                                                 jsonRpcSerializer.SerializeRequestAsync(null, jsonStream));
            }
        }
Ejemplo n.º 6
0
        public async void CoreSerializeRequestAsyncToStream()
        {
            var jsonSample        = EmbeddedResourceManager.GetString("Assets.v2_core_req.json");
            var jsonRpcSerializer = new JsonRpcSerializer();
            var jsonRpcMessage    = new JsonRpcRequest("m", 0L);

            using (var jsonStream = new MemoryStream())
            {
                await jsonRpcSerializer.SerializeRequestAsync(jsonRpcMessage, jsonStream);

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

                CompareJsonStrings(jsonSample, jsonResult);
            }
        }