Spring.Expressions.Foo.MethodWithArrayArgument C# (CSharp) Method

MethodWithArrayArgument() public method

public MethodWithArrayArgument ( string values ) : string
values string
return string
        public string MethodWithArrayArgument(string[] values)
        {
            return string.Join("|", values);
        }

Usage Example

Ejemplo n.º 1
0
        public void TestMethodResolutionWithParamArray()
        {
            Foo foo = new Foo();
            Assert.AreEqual("a|b|c", foo.MethodWithArrayArgument(new string[] { "a", "b", "c" }));
            Assert.AreEqual("a||c", foo.MethodWithArrayArgument(new string[] { "a", null, "c" }));
            Assert.AreEqual("a|b|c", foo.MethodWithParamArray("a", "b", "c"));
            Assert.AreEqual("a||c", foo.MethodWithParamArray("a", null, "c"));

            Assert.AreEqual("a|b|c", ExpressionEvaluator.GetValue(foo, "MethodWithArrayArgument(new string[] { 'a', 'b', 'c' })"));
            Assert.AreEqual("a||c", ExpressionEvaluator.GetValue(foo, "MethodWithArrayArgument(new string[] { 'a', null, 'c' })"));
            Assert.AreEqual("a|b|c", ExpressionEvaluator.GetValue(foo, "MethodWithParamArray('a', 'b', 'c')"));
            Assert.AreEqual("a||c", ExpressionEvaluator.GetValue(foo, "MethodWithParamArray('a', null, 'c')"));

            Assert.AreEqual("a|b|c", ExpressionEvaluator.GetValue(foo, "MethodWithParamArray(false, 'a', 'b', 'c')"));
            Assert.AreEqual("a||c", ExpressionEvaluator.GetValue(foo, "MethodWithParamArray(false, 'a', null, 'c')"));
            Assert.AreEqual("A|B|C", ExpressionEvaluator.GetValue(foo, "MethodWithParamArray(true, 'a', 'b', 'c')"));
            Assert.AreEqual("A||C", ExpressionEvaluator.GetValue(foo, "MethodWithParamArray(true, 'a', null, 'c')"));
        }