public async void CoreSerializeResponseAsyncToStreamWhenStreamIsNull() { var jsonSample = EmbeddedResourceManager.GetString("Assets.v2_core_res.json"); var jsonRpcSerializer = new JsonRpcSerializer(); var jsonRpcMessage = new JsonRpcResponse(0L, 0L); await Assert.ThrowsAsync <ArgumentNullException>(() => jsonRpcSerializer.SerializeResponseAsync(jsonRpcMessage, null)); }
public async void CoreSerializeResponseAsyncToStreamWhenResponseIsNull() { var jsonRpcSerializer = new JsonRpcSerializer(); var jsonRpcMessage = new JsonRpcRequest("m", 0L); using (var jsonStream = new MemoryStream()) { await Assert.ThrowsAsync <ArgumentNullException>(() => jsonRpcSerializer.SerializeResponseAsync(null, jsonStream)); } }
public async void CoreSerializeResponseAsyncToStream() { var jsonSample = EmbeddedResourceManager.GetString("Assets.v2_core_res.json"); var jsonRpcSerializer = new JsonRpcSerializer(); var jsonRpcMessage = new JsonRpcResponse(0L, 0L); using (var jsonStream = new MemoryStream()) { await jsonRpcSerializer.SerializeResponseAsync(jsonRpcMessage, jsonStream); var jsonResult = Encoding.UTF8.GetString(jsonStream.ToArray()); CompareJsonStrings(jsonSample, jsonResult); } }