本文整理汇总了C#中ApplicationData类的典型用法代码示例。如果您正苦于以下问题:C# ApplicationData类的具体用法?C# ApplicationData怎么用?C# ApplicationData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ApplicationData类属于命名空间,在下文中一共展示了ApplicationData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MatchValue
public void MatchValue()
{
ApplicationData postedData = new ApplicationData { { "First_name", "Superman" } };
ApplicationData applicationData = new ApplicationData();
bool result = this.evaluator.Evaluate(this.condition, this.ControlList, postedData, applicationData, this.EvaluatorRegister);
Assert.IsTrue(result);
}
示例2: Create
/// <summary>
/// Creates a new <see cref="TransactionVariables"/>.
/// </summary>
/// <param name="formId">The form id.</param>
/// <param name="applicationId">The application id.</param>
/// <param name="applicationData">The application data.</param>
/// <returns>A new <see cref="TransactionVariables"/>.</returns>
public TransactionVariables Create(string formId, string applicationId, ApplicationData applicationData)
{
ExpressionEvaluator evaluator = new ExpressionEvaluator(new Application(null, formId, null, applicationId, applicationData));
double amountValue = evaluator.Evaluate<double>(this.AmountExpression);
string referenceValue = evaluator.Evaluate<string>(this.ReferenceExpression);
return new TransactionVariables(this.MerchantPassword, amountValue, referenceValue);
}
示例3: NotMatchNonEmptyStringValue
public void NotMatchNonEmptyStringValue()
{
ApplicationData postedData = new ApplicationData { { "First_name", "AmazingMan" } };
ApplicationData applicationData = new ApplicationData();
bool result = this.evaluator.Evaluate(this.condition, this.ControlList, postedData, applicationData, this.EvaluatorRegister);
Assert.IsTrue(result);
}
示例4: MatchValueWithSpaces
public void MatchValueWithSpaces()
{
ApplicationData postedData = new ApplicationData { { "First_name", "Amazing Man" } };
ApplicationData applicationData = new ApplicationData();
bool result = this.evaluator.Evaluate(this.condition, this.ControlList, postedData, applicationData, this.EvaluatorRegister);
Assert.IsFalse(result);
}
示例5: GreaterThanValue
public void GreaterThanValue()
{
ApplicationData postedData = new ApplicationData { { "First_name", "Mix" } };
ApplicationData applicationData = new ApplicationData();
bool result = this.evaluator.Evaluate(this.condition, this.ControlList, postedData, applicationData, this.EvaluatorRegister);
Assert.IsFalse(result);
}
示例6: LessThanDoubleValue
public void LessThanDoubleValue()
{
ApplicationData postedData = new ApplicationData { { "Age", "49.5" } };
ApplicationData applicationData = new ApplicationData();
bool result = this.evaluator.Evaluate(this.condition, this.ControlList, postedData, applicationData, this.EvaluatorRegister);
Assert.IsTrue(result);
}
示例7: Application
/// <summary>
/// Initializes a new instance of the <see cref="Application"/> class.
/// </summary>
/// <param name="organisationId">The organisation id.</param>
/// <param name="formId">The form id.</param>
/// <param name="formVersion">The form version number.</param>
/// <param name="applicationId">The application id.</param>
/// <param name="applicationData">The application data.</param>
public Application(string organisationId, string formId, int? formVersion, string applicationId = null, ApplicationData applicationData = null)
: this(applicationData, applicationId)
{
this.OrganisationId = organisationId;
this.FormId = formId;
this.FormVersion = formVersion;
}
示例8: FieldMissing
public void FieldMissing()
{
ApplicationData postedData = new ApplicationData();
ApplicationData applicationData = new ApplicationData();
bool result = this.evaluator.Evaluate(this.condition, this.ControlList, postedData, applicationData, this.EvaluatorRegister);
Assert.IsFalse(result);
}
示例9: TestControlName
public void TestControlName()
{
string json = AssemblyResourceReader.ReadAsString("Test_Data.ValidateRule1.json");
ValidateTruthCondition condition = JsonConvert.DeserializeObject<ValidateTruthCondition>(json);
ControlList controlList = new ControlList();
RepeaterControl repeater = new RepeaterControl
{ Id = 3, Name = "Repeater" };
controlList.Add(repeater);
repeater.Controls.Add(new TextControl { Id = 1, Name = "Field1", ParentId = 3 });
repeater.Controls.Add(new TextControl { Id = 2, Name = "Field2", ParentId = 3 });
ApplicationData appData = new ApplicationData();
Dictionary<string, object>[] repeaterData = new Dictionary<string, object>[2];
appData.Add("Repeater", repeaterData);
repeaterData[0] = new Dictionary<string, object>
{
{ "Field1", "Is Valid" },
{ "Field2", "When Combined With This" }
};
repeaterData[1] = new Dictionary<string, object>
{
{ "Field1", "Not Valid" },
{ "Field2", "When Combined With This" }
};
TruthConditionEvaluatorFactory evaluatorFactory = new TruthConditionEvaluatorFactory();
ITruthConditionValidator validator = new ITruthConditionValidator(condition, controlList, evaluatorFactory);
ValidationResults results = validator.Validate(appData);
Assert.AreEqual("Repeater[1].Field1", results.ToArray()[0].Key);
}
示例10: DoesNotExist
public void DoesNotExist()
{
ApplicationData postedData = new ApplicationData();
ApplicationData applicationData = new ApplicationData { { "First_name", "Batman" } };
bool result = this.evaluator.Evaluate(this.condition, this.ControlList, postedData, applicationData, this.EvaluatorRegister);
Assert.IsFalse(result);
}
示例11: MatchValueCaseDifferent
public void MatchValueCaseDifferent()
{
ApplicationData postedData = new ApplicationData { { "First_name", "spIdERmAn" } };
ApplicationData applicationData = new ApplicationData();
bool result = this.evaluator.Evaluate(this.condition, this.ControlList, postedData, applicationData, this.EvaluatorRegister);
Assert.IsFalse(result);
}
示例12: LatitudeGreaterThanDoubleValue
public void LatitudeGreaterThanDoubleValue()
{
ApplicationData postedData = new ApplicationData { { "Geolocation", "100,300" } };
ApplicationData applicationData = new ApplicationData();
bool result = this.evaluatorLat.Evaluate(this.conditionLat, this.ControlList, postedData, applicationData, this.EvaluatorRegister);
Assert.IsTrue(result);
}
示例13: LongitudeLessThanDoubleValue
public void LongitudeLessThanDoubleValue()
{
ApplicationData postedData = new ApplicationData { { "Geolocation", "300,49.5" } };
ApplicationData applicationData = new ApplicationData();
bool result = this.evaluatorLong.Evaluate(this.conditionLong, this.ControlList, postedData, applicationData, this.EvaluatorRegister);
Assert.IsFalse(result);
}
示例14: RepeaterHideRuleReferenceRootControl
public void RepeaterHideRuleReferenceRootControl()
{
ITruthCondition condition = new HideTruthCondition { RuleType = "HIDE" };
TruthConditionList subRuleList = new TruthConditionList();
CompareDefinition compareDefinition = new CompareDefinition { CompareTo = ComparisonType.Value, Field = "Checkbox", FieldScope = FieldScope.Unknown, Operator = Operator.Equals, Value = "checked" };
subRuleList.Add(new CompareTruthCondition { RuleType = "EVAL", Value = compareDefinition });
condition.Value = subRuleList;
ControlList controlList = new ControlList { new CheckboxControl { Name = "Checkbox" } };
RepeaterControl repeater = new RepeaterControl { Name = "Parent" };
repeater.AddChild(new ComboControl { Name = "Child", VisibilityRule = condition });
controlList.Add(repeater);
ApplicationData applicationData = new ApplicationData { { "Checkbox", "checked" } };
Dictionary<string, object>[] repeaterValue = new Dictionary<string, object>[1];
repeaterValue[0] = new Dictionary<string, object>();
repeaterValue[0]["Child"] = string.Empty;
applicationData.Add("Parent", repeaterValue);
ITruthConditionEvaluator<ITruthCondition> evaluator = this.EvaluatorRegister.GetEvaluatorFor<HideTruthCondition>();
bool result = evaluator.Evaluate(condition, controlList, applicationData, null, this.EvaluatorRegister, "Parent[0]");
Assert.IsTrue(result);
applicationData["Checkbox"] = string.Empty;
result = evaluator.Evaluate(condition, controlList, applicationData, null, this.EvaluatorRegister, "Parent[0]");
Assert.IsFalse(result);
}
示例15: TestSerializeCheckboxGroup
public void TestSerializeCheckboxGroup()
{
ApplicationData application = new ApplicationData { { "CheckboxGroupControl", new[] { "one", "three" } } };
string json = JsonConvert.SerializeObject(application, Formatting.None);
const string expected = "{\"CheckboxGroupControl\":[\"one\",\"three\"]}";
Assert.AreEqual(expected, json);
}