|
|
|
@ -32,7 +32,7 @@ namespace ICSharpCode.NRefactory.CSharp.CodeActions
@@ -32,7 +32,7 @@ namespace ICSharpCode.NRefactory.CSharp.CodeActions
|
|
|
|
|
[TestFixture] |
|
|
|
|
public class ImplementAbstractMembersTest : ContextActionTestBase |
|
|
|
|
{ |
|
|
|
|
[Test()] |
|
|
|
|
[Test] |
|
|
|
|
public void TestSimpleBaseType() |
|
|
|
|
{ |
|
|
|
|
Test<ImplementAbstractMembersAction>(@"abstract class Simple {
|
|
|
|
@ -58,7 +58,7 @@ class Foo : Simple
@@ -58,7 +58,7 @@ class Foo : Simple
|
|
|
|
|
");
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[Test()] |
|
|
|
|
[Test] |
|
|
|
|
public void TestProtectedMembers() |
|
|
|
|
{ |
|
|
|
|
Test<ImplementAbstractMembersAction>(@"abstract class Simple {
|
|
|
|
@ -85,7 +85,7 @@ class Foo : Simple
@@ -85,7 +85,7 @@ class Foo : Simple
|
|
|
|
|
");
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[Test()] |
|
|
|
|
[Test] |
|
|
|
|
public void TestProtectedInternalMembers() |
|
|
|
|
{ |
|
|
|
|
Test<ImplementAbstractMembersAction>(@"abstract class Simple {
|
|
|
|
@ -111,6 +111,91 @@ class Foo : Simple
@@ -111,6 +111,91 @@ class Foo : Simple
|
|
|
|
|
} |
|
|
|
|
");
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
|
public void TestAbstractOverride() |
|
|
|
|
{ |
|
|
|
|
Test<ImplementAbstractMembersAction>(@"class A {
|
|
|
|
|
public virtual void Foo() { |
|
|
|
|
Console.WriteLine(""A:Foo()""); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
abstract class B : A { |
|
|
|
|
public abstract override void Foo(); |
|
|
|
|
public abstract void FooBar(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class C : $B |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
", @"class A { |
|
|
|
|
public virtual void Foo() { |
|
|
|
|
Console.WriteLine(""A:Foo()""); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
abstract class B : A { |
|
|
|
|
public abstract override void Foo(); |
|
|
|
|
public abstract void FooBar(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class C : B |
|
|
|
|
{ |
|
|
|
|
#region implemented abstract members of B
|
|
|
|
|
public override void Foo () |
|
|
|
|
{ |
|
|
|
|
throw new System.NotImplementedException (); |
|
|
|
|
} |
|
|
|
|
public override void FooBar () |
|
|
|
|
{ |
|
|
|
|
throw new System.NotImplementedException (); |
|
|
|
|
} |
|
|
|
|
#endregion
|
|
|
|
|
} |
|
|
|
|
");
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
|
public void TestAlreadyImplemented() |
|
|
|
|
{ |
|
|
|
|
Test<ImplementAbstractMembersAction>(@"class A {
|
|
|
|
|
public abstract void Foo(); |
|
|
|
|
public abstract void FooBar(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
abstract class B : A { |
|
|
|
|
public override void Foo() {} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class C : $B |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
", @"class A { |
|
|
|
|
public abstract void Foo(); |
|
|
|
|
public abstract void FooBar(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
abstract class B : A { |
|
|
|
|
public override void Foo() {} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class C : B |
|
|
|
|
{ |
|
|
|
|
#region implemented abstract members of A
|
|
|
|
|
public override void FooBar () |
|
|
|
|
{ |
|
|
|
|
throw new System.NotImplementedException (); |
|
|
|
|
} |
|
|
|
|
#endregion
|
|
|
|
|
} |
|
|
|
|
");
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|