Browse Source

Tests demonstrating that the accessors for a property that implements an interface property do not have any ImplementedInterfaceMembers.

newNRvisualizers
erikkallen 14 years ago
parent
commit
baad38a590
  1. 12
      ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.TestCase.cs
  2. 9
      ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.cs

12
ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.TestCase.cs

@ -236,4 +236,16 @@ namespace ICSharpCode.NRefactory.TypeSystem.TestCase @@ -236,4 +236,16 @@ namespace ICSharpCode.NRefactory.TypeSystem.TestCase
public static int Prop3 { get; set; }
public int Prop4 { get; set; }
}
public interface IInterfaceWithProperty {
int Prop { get; set; }
}
public class ClassWithVirtualProperty {
public virtual int Prop { get; set; }
}
public class ClassThatImplementsProperty : IInterfaceWithProperty {
public int Prop { get; set; }
}
}

9
ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.cs

@ -847,5 +847,14 @@ namespace ICSharpCode.NRefactory.TypeSystem @@ -847,5 +847,14 @@ namespace ICSharpCode.NRefactory.TypeSystem
Assert.AreEqual("add_Event3", normalEvent.AddAccessor.Name);
Assert.AreEqual("remove_Event3", normalEvent.RemoveAccessor.Name);
}
[Test]
public void PropertyAccessorsShouldBeReportedAsImplementingInterfaceAccessors() {
ITypeDefinition type = GetTypeDefinition(typeof(ClassThatImplementsProperty));
var prop = type.Properties.Single(p => p.Name == "Prop");
Assert.That(prop.ImplementedInterfaceMembers.Select(p => p.ReflectionName).ToList(), Is.EqualTo(new[] { "ICSharpCode.NRefactory.TypeSystem.TestCase.IInterfaceWithProperty.Prop" }));
Assert.That(prop.Getter.ImplementedInterfaceMembers.Select(p => p.ReflectionName).ToList(), Is.EqualTo(new[] { "ICSharpCode.NRefactory.TypeSystem.TestCase.IInterfaceWithProperty.get_Prop" }));
Assert.That(prop.Setter.ImplementedInterfaceMembers.Select(p => p.ReflectionName).ToList(), Is.EqualTo(new[] { "ICSharpCode.NRefactory.TypeSystem.TestCase.IInterfaceWithProperty.set_Prop" }));
}
}
}

Loading…
Cancel
Save