本文整理汇总了C#中Payload.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Payload.Add方法的具体用法?C# Payload.Add怎么用?C# Payload.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Payload
的用法示例。
在下文中一共展示了Payload.Add方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: testAddEmptyString
public void testAddEmptyString()
{
var payload = new Payload();
payload.Add("empty", "");
var pairs = payload.NvPairs;
Assert.IsFalse(pairs.ContainsKey("name"));
}
示例2: ToPayload
private Payload ToPayload(IEnumerable<File> files)
{
var payload = new Payload();
foreach (var file in files) {
payload.Add(
PayloadName,
new DataItem(new FileInfo(file.FullName), file.ContentType)
);
}
return payload;
}
示例3: ToPayload
private Payload ToPayload(ProductSeed seed, params Design[] designs)
{
var payload = new Payload {
{ "name", seed.Name},
{ "notes", seed.Notes},
{ "ref", seed.Reference}
};
foreach (var design in designs) {
payload.AddRange(ToFields(design));
payload.Add(
"designs[][uploaded_data]",
new DataItem(new FileInfo(design.Filename), "xxx")
);
}
return payload;
}
示例4: SetPayload
public Message SetPayload(IEnumerable<XElement> elements)
{
Logger.Debug("Step");
Payload = new Payload();
foreach(var element in elements)
Payload.Add(element);
return this;
}
示例5: testAddNumber
public void testAddNumber()
{
var payload = new Payload();
payload.Add("price", 99.9);
var pairs = payload.NvPairs;
Assert.AreEqual(pairs["price"],"99.9");
}
示例6: testAddNull
public void testAddNull()
{
var payload = new Payload();
string nullString = null;
payload.Add("null", nullString);
var pairs = payload.NvPairs;
Assert.IsFalse(pairs.ContainsKey("null"));
}
示例7: testAddString
public void testAddString()
{
var payload = new Payload();
payload.Add("name", "value");
var pairs = payload.NvPairs;
Assert.AreEqual(pairs["name"], "value");
}