本文整理汇总了C#中ApplicationData.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# ApplicationData.ContainsKey方法的具体用法?C# ApplicationData.ContainsKey怎么用?C# ApplicationData.ContainsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApplicationData
的用法示例。
在下文中一共展示了ApplicationData.ContainsKey方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveNonExistantField
public void SaveNonExistantField()
{
const string formId = "10";
const string userId = "007";
ControlList controls = this.GetControlList(formId);
List<ControlAccess> controlsAccess = this.GetControlAccess(formId, userId);
ApplicationData input = new ApplicationData();
input["bad-field"] = "my legal value";
ApplicationDataVerifier verifier = new ApplicationDataVerifier(controls, controlsAccess);
ApplicationData output = verifier.VerifyApplicationData(input, null);
Assert.IsTrue(input.ContainsKey("bad-field"));
Assert.IsNotNull(input.GetValue<string>("bad-field"));
Assert.IsFalse(output.ContainsKey("bad-field"));
}
示例2: SaveNonExistantRepeaterData
public void SaveNonExistantRepeaterData()
{
const string formId = "11";
const string userId = "007";
ControlList controls = this.GetControlList(formId);
List<ControlAccess> controlsAccess = this.GetControlAccess(formId, userId);
ApplicationData input = new ApplicationData();
input["bad-repeater"] = new object[0];
ApplicationData previousAppData = new ApplicationData();
previousAppData["bad-repeater"] = new object[0];
ApplicationDataVerifier verifier = new ApplicationDataVerifier(controls, controlsAccess);
ApplicationData output = verifier.VerifyApplicationData(input, previousAppData);
Assert.IsTrue(input.ContainsKey("bad-repeater"));
Assert.IsFalse(output.ContainsKey("bad-repeater"));
}
示例3: Unknown
public void Unknown()
{
ApplicationData target = new ApplicationData();
target["field1"] = "leave me alone!";
ApplicationData source = new ApplicationData();
source["field2"] = "you've been overwritten!";
source["field3"] = "I am the unknown control!";
target.UpdateFrom(source);
Assert.IsFalse(target.ContainsKey("field3"));
}
示例4: SaveNonExistantRepeaterChild
public void SaveNonExistantRepeaterChild()
{
const string formId = "11";
const string userId = "007";
ControlList controls = this.GetControlList(formId);
List<ControlAccess> controlsAccess = this.GetControlAccess(formId, userId);
ApplicationData input = new ApplicationData();
Dictionary<string, object>[] repeater = new Dictionary<string, object>[1];
input["write-repeater"] = repeater;
repeater[0] = new Dictionary<string, object>();
repeater[0]["bad-field"] = "this field is writeable!";
ApplicationDataVerifier verifier = new ApplicationDataVerifier(controls, controlsAccess);
ApplicationData output = verifier.VerifyApplicationData(input, null);
Assert.IsTrue(input.ContainsKey("write-repeater"));
Assert.IsNotNull(input.GetValue<string>("write-repeater[0].bad-field"));
Assert.IsTrue(output.ContainsKey("write-repeater"));
Assert.IsNull(output.GetValue<string>("write-repeater[0].bad-field"));
}
示例5: ControlWithNoDefaultValueIsNotAdded
public void ControlWithNoDefaultValueIsNotAdded()
{
ApplicationData applicationData = new ApplicationData();
this.initialiser.Initialise(applicationData);
Assert.IsFalse(applicationData.ContainsKey("ControlWithNoDefaultValue"));
}