public void Should_Parse_Resp() { var rsp = new TsGetResp(); rsp.columns.AddRange(TsCols); rsp.rows.AddRange(TsRows); Get cmd = BuildGetReqWithTimeout(); cmd.OnSuccess(rsp); GetResponse response = cmd.Response; var rcols = response.Columns.ToArray(); CollectionAssert.AreEqual(Columns, rcols); var rr = response.Value.ToArray(); for (int i = 0; i < rr.Length; i++) { TsRow tsr = TsRows[i]; TsCell[] tscs = tsr.cells.ToArray(); Row r = rr[i]; Cell[] rcs = r.Cells.ToArray(); Assert.AreEqual(tsr.cells.Count, rcs.Length); for (int j = 0; j < tscs.Length; j++) { TsCell tsc = tscs[j]; Cell c = rcs[j]; if (tsc.boolean_valueSpecified) { Assert.AreEqual(tsc.boolean_value, c.Value); } else if (tsc.double_valueSpecified) { Assert.AreEqual(tsc.double_value, c.Value); } else if (tsc.sint64_valueSpecified) { Assert.AreEqual(tsc.sint64_value, c.Value); } else if (tsc.timestamp_valueSpecified) { Assert.AreEqual( tsc.timestamp_value, c.Value); } else if (tsc.varchar_valueSpecified) { byte[] tsc_val = tsc.varchar_value; byte[] cell_val = (byte[])c.Value; CollectionAssert.AreEqual(tsc_val, cell_val); } else { Assert.Fail(); } } } }
public ResponseDecoder(TsGetResp response) : this(response.columns, response.rows) { }
public ResponseDecoder(TsGetResp response) : this(response.columns, response.rows) { }