Quantcast
Channel: Fast Lightweight Expression Evaluator
Viewing all articles
Browse latest Browse all 96

Closed Feature: Indexer with more than one argument gives parser exception [7013]

$
0
0
Calling an indexer with more than one argument gives a parse exception on the list separator.
 
Unit tests:
 
[TestMethod]
public void TestIndexerWithOneArgument() {
ExpressionContext context = new ExpressionContext(new IndexerContainer());
IGenericExpression<string> expr = ExpressionFactory.CreateGeneric<string>("Indexer[\"Bob\"]", context);
Assert.AreEqual("name : Bob, selected : False", expr.Evaluate());
}
 
[TestMethod]
public void TestIndexerWithTwoArguments() {
ExpressionContext context = new ExpressionContext(new IndexerContainer());
IGenericExpression<string> expr = ExpressionFactory.CreateGeneric<string>("Indexer[\"Bob\"; true]", context);
Assert.AreEqual("name : Bob, selected : True", expr.Evaluate());
}
 
 
public class IndexerContainer {
public IndexerClass Indexer = new IndexerClass();
}
public class IndexerClass {
public string this[string name] {
get {
return this[name, false];
}
}
public string this[string name, bool isSelected] {
get {
return string.Format("name : {0}, selected : {1}", name, isSelected);
}
}
}
 
 
The first test succeeds, the second fails. I think it should succeed.
 
Can you have a look at the issue? Thanks!
 
BTW: I'm running these tests with a Dutch current culture, so I used ';' as list separator.

Viewing all articles
Browse latest Browse all 96

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>