Parse() 공개 정적인 메소드

public static Parse ( string input ) : RuntimeParameter
input string
리턴 RuntimeParameter
예제 #1
0
        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);
        }
예제 #2
0
        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");
        }
예제 #3
0
        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");
        }
예제 #4
0
        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");
        }
예제 #5
0
        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");
        }