Permalink
Browse files

Failing test with explicit indexer implementation

  • Loading branch information...
1 parent fd39748 commit 4d868ba2b32c318872a053b4885305844b4997db @erik-kallen erik-kallen committed Jun 14, 2012
View
7 ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.TestCase.cs
@@ -264,4 +264,11 @@ public class ClassThatImplementsIndexers : IInterfaceWithIndexers, IGenericInter
public int this[string x] { get { return 0; } set {} }
public int this[int x, int y] { get { return 0; } set {} }
}
+
+ public class ClassThatImplementsIndexersExplicitly : IInterfaceWithIndexers, IGenericInterfaceWithIndexer<int> {
+ int IInterfaceWithIndexers.this[int x] { get { return 0; } set {} }
+ int IGenericInterfaceWithIndexer<int>.this[int x] { get { return 0; } set {} }
+ int IInterfaceWithIndexers.this[string x] { get { return 0; } set {} }
+ int IInterfaceWithIndexers.this[int x, int y] { get { return 0; } set {} }
+ }
}
View
9 ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.cs
@@ -885,5 +885,14 @@ public void EventAccessorNames()
Assert.That(ix3.Setter.ImplementedInterfaceMembers.Select(p => p.ReflectionName).ToList(), Is.EqualTo(new[] { "ICSharpCode.NRefactory.TypeSystem.TestCase.IInterfaceWithIndexers.set_Item" }));
Assert.That(ix3.Setter.ImplementedInterfaceMembers.All(m => ((IMethod)m).Parameters.Select(p => p.Type.GetDefinition().KnownTypeCode).SequenceEqual(new[] { KnownTypeCode.Int32, KnownTypeCode.Int32, KnownTypeCode.Int32 })));
}
+
+ [Test]
+ public void ExplicitIndexerImplementationReturnsTheCorrectMembers() {
+ ITypeDefinition type = GetTypeDefinition(typeof(ClassThatImplementsIndexersExplicitly));
+
+ Assert.That(type.Properties.All(p => p.ImplementedInterfaceMembers.Count == 1));
+ Assert.That(type.Properties.All(p => p.Getter.ImplementedInterfaceMembers.Count == 1));
+ Assert.That(type.Properties.All(p => p.Setter.ImplementedInterfaceMembers.Count == 1));
+ }
}
}

0 comments on commit 4d868ba

Please sign in to comment.