Browse Source

Failing test for IsOverride flag of accessors.

newNRvisualizers
erikkallen 13 years ago
parent
commit
840cde91d4
  1. 8
      ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.TestCase.cs
  2. 20
      ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.cs

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

@ -234,4 +234,12 @@ namespace ICSharpCode.NRefactory.TypeSystem.TestCase @@ -234,4 +234,12 @@ 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; }
}
}

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

@ -836,5 +836,25 @@ namespace ICSharpCode.NRefactory.TypeSystem @@ -836,5 +836,25 @@ namespace ICSharpCode.NRefactory.TypeSystem
Assert.AreEqual("add_Event3", normalEvent.AddAccessor.Name);
Assert.AreEqual("remove_Event3", normalEvent.RemoveAccessor.Name);
}
[Test]
public void InterfacePropertyAccessorsShouldNotBeOverrides() {
ITypeDefinition type = GetTypeDefinition(typeof(IInterfaceWithProperty));
var prop = type.Properties.Single(p => p.Name == "Prop");
Assert.That(prop.Getter.IsOverride, Is.False);
Assert.That(prop.Getter.IsOverridable, Is.True);
Assert.That(prop.Setter.IsOverride, Is.False);
Assert.That(prop.Setter.IsOverridable, Is.True);
}
[Test]
public void VirtualPropertyAccessorsShouldNotBeOverrides() {
ITypeDefinition type = GetTypeDefinition(typeof(ClassWithVirtualProperty));
var prop = type.Properties.Single(p => p.Name == "Prop");
Assert.That(prop.Getter.IsOverride, Is.False);
Assert.That(prop.Getter.IsOverridable, Is.True);
Assert.That(prop.Setter.IsOverride, Is.False);
Assert.That(prop.Setter.IsOverridable, Is.True);
}
}
}

Loading…
Cancel
Save