public void RuntimeParameterParseTest4() { RuntimeParameter rp = RuntimeParameter.Parse("{attributeName:formatString}"); // Stuff that should be populated Assert.AreEqual(rp.AttributeName, "attributeName"); Assert.AreEqual(rp.StringFormatter, "formatString"); // Stuff that should not be populated Assert.AreEqual(rp.Conditional, new RuntimeParameter.ConditionalFormatter()); Assert.AreEqual(rp.DefaultValue, String.Empty); Assert.AreEqual(rp.ParentLookupName, String.Empty); }
public void RuntimeParameterParseTest11() { RuntimeParameter rp = RuntimeParameter.Parse("{attributeName:<2015-1-1?trueValue|falseValue}"); // Stuff that should be populated Assert.AreEqual(rp.AttributeName, "attributeName"); // Stuff that should not be populated Assert.AreEqual(rp.DefaultValue, String.Empty); Assert.AreEqual(rp.ParentLookupName, String.Empty); Assert.AreEqual(rp.StringFormatter, String.Empty); // Conditional test cases Assert.AreEqual(rp.Conditional.GetResult(new DateTime(2014, 1, 1)), "trueValue"); Assert.AreEqual(rp.Conditional.GetResult(new DateTime(2016, 1, 1)), "falseValue"); }
public void RuntimeParameterParseTest9() { RuntimeParameter rp = RuntimeParameter.Parse("{attributeName|defaultValue:formatString:matchValue?trueValue|falseValue}"); // Stuff that should be populated Assert.AreEqual(rp.AttributeName, "attributeName"); Assert.AreEqual(rp.DefaultValue, "defaultValue"); Assert.AreEqual(rp.StringFormatter, "formatString"); // Stuff that should not be populated Assert.AreEqual(rp.ParentLookupName, String.Empty); // Conditional test cases Assert.AreEqual(rp.Conditional.GetResult("matchValue"), "trueValue"); Assert.AreEqual(rp.Conditional.GetResult("other"), "falseValue"); }
public void RuntimeParameterParseTest6() { RuntimeParameter rp = RuntimeParameter.Parse("{attributeName:match1?result1|match2?result2|match3?result3|elseResult}"); // Stuff that should be populated Assert.AreEqual(rp.AttributeName, "attributeName"); // Stuff that should not be populated Assert.AreEqual(rp.DefaultValue, String.Empty); Assert.AreEqual(rp.ParentLookupName, String.Empty); Assert.AreEqual(rp.StringFormatter, String.Empty); // Conditional test cases Assert.AreEqual(rp.Conditional.GetResult("match1"), "result1"); Assert.AreEqual(rp.Conditional.GetResult("match2"), "result2"); Assert.AreEqual(rp.Conditional.GetResult("match3"), "result3"); Assert.AreEqual(rp.Conditional.GetResult("other"), "elseResult"); }
public void RuntimeParameterParseTest12() { RuntimeParameter rp = RuntimeParameter.Parse("{attributeName:yyyy:2015?trueValue|falseValue}"); // Stuff that should be populated Assert.AreEqual(rp.AttributeName, "attributeName"); Assert.AreEqual(rp.StringFormatter, "yyyy"); // Stuff that should not be populated Assert.AreEqual(rp.DefaultValue, String.Empty); Assert.AreEqual(rp.ParentLookupName, String.Empty); // Conditional test cases Entity test = new Entity(); test["attributeName"] = new DateTime(2015, 1, 1); Assert.AreEqual(rp.GetParameterValue(test), "trueValue"); test["attributeName"] = new DateTime(2016, 1, 1); Assert.AreEqual(rp.GetParameterValue(test), "falseValue"); }