public async Task SerializeRequestAsyncWhenRequestIsNull() { var jrs = new JsonRpcSerializer(); await Assert.ThrowsExceptionAsync <ArgumentNullException>(() => jrs.SerializeRequestAsync(null, default).AsTask()); }
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());
public async void CoreSerializeRequestAsyncToStreamWhenStreamIsNull() { var jsonRpcSerializer = new JsonRpcSerializer(); var jsonRpcMessage = new JsonRpcRequest("m", 0L); await Assert.ThrowsAsync <ArgumentNullException>(() => jsonRpcSerializer.SerializeRequestAsync(jsonRpcMessage, null)); }
public async Task SerializeRequestAsyncWithStreamWhenRequestIsNull() { var jrs = new JsonRpcSerializer(); using var stream = new MemoryStream(); await Assert.ThrowsExceptionAsync <ArgumentNullException>(() => jrs.SerializeRequestAsync(null, stream, default).AsTask()); }
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)); } }
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); } }