icsharpcode/NRefactory — Issue #13: Indexer accessors do not get correct parameters.
Author: erik-kallen
Created: 2012-02-08 00:15:13+00:00
State: open

Given this class:

public class IndexerTest
{
public string this[int index] { get { return "Test"; } set {} }
}

the following test will fail with the TypeSystemConvertVisitor (but not with the CecilLoader):

[Test]
public void IndexerParameters()
{
var testClass = GetTypeDefinition(typeof(IndexerTest));
IProperty p = testClass.Properties.Single(pr => pr.IsIndexer);
Assert.AreEqual("Item", p.Name);
Assert.AreEqual(new[] { "index" }, p.Getter.Parameters.Select(x => x.Name).ToArray());
Assert.AreEqual(new[] { "index", "value" }, p.Setter.Parameters.Select(x => x.Name).ToArray());
}