本文整理汇总了C#中SimpleStatement.SetOutgoingPayload方法的典型用法代码示例。如果您正苦于以下问题:C# SimpleStatement.SetOutgoingPayload方法的具体用法?C# SimpleStatement.SetOutgoingPayload怎么用?C# SimpleStatement.SetOutgoingPayload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleStatement
的用法示例。
在下文中一共展示了SimpleStatement.SetOutgoingPayload方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Query_Payload_Test
public void Query_Payload_Test()
{
var outgoing = new Dictionary<string, byte[]> { { "k1", Encoding.UTF8.GetBytes("value1") }, { "k2", Encoding.UTF8.GetBytes("value2") } };
var stmt = new SimpleStatement("SELECT * FROM system.local");
stmt.SetOutgoingPayload(outgoing);
var rs = Session.Execute(stmt);
Assert.NotNull(rs.Info.IncomingPayload);
Assert.AreEqual(outgoing.Count, rs.Info.IncomingPayload.Count);
CollectionAssert.AreEqual(outgoing["k1"], rs.Info.IncomingPayload["k1"]);
CollectionAssert.AreEqual(outgoing["k2"], rs.Info.IncomingPayload["k2"]);
}
示例2: Warnings_With_Custom_Payload_Test
public void Warnings_With_Custom_Payload_Test()
{
const string query = "BEGIN UNLOGGED BATCH INSERT INTO {0} (k, t) VALUES ('{1}', '{2}') APPLY BATCH";
SimpleStatement insert = new SimpleStatement(String.Format(query, Table, "warn1", String.Join("", Enumerable.Repeat("a", 5 * 1025))));
var outgoing = new Dictionary<string, byte[]> { { "k1", Encoding.UTF8.GetBytes("value1") }, { "k2", Encoding.UTF8.GetBytes("value2") } };
insert.SetOutgoingPayload(outgoing);
var rs = Session.Execute(insert);
Assert.NotNull(rs.Info.Warnings);
Assert.AreEqual(1, rs.Info.Warnings.Length);
StringAssert.Contains("batch", rs.Info.Warnings[0].ToLowerInvariant());
StringAssert.Contains("exceeding", rs.Info.Warnings[0].ToLowerInvariant());
CollectionAssert.AreEqual(outgoing["k1"], rs.Info.IncomingPayload["k1"]);
CollectionAssert.AreEqual(outgoing["k2"], rs.Info.IncomingPayload["k2"]);
}