Skip to content

Is there a way to check if a class is inherited? #330

Closed
@Urganot

Description

@Urganot

Hi,

I am working an a asp.net web api. for this I am generating the controller from a openapi specification. The generator generates the controller classes and methods as abstract.

What I now want to do is to check if all generated controller classes are inherited somewhere.

Finding all controller is easy by using Classes().That().ResideInNamespace("MyProject.Generated.*", true).And().AreAbstract().And() .HaveFullNameContaining("Controller"). What I am struggling with is

  1. Finding all methods that are declared in those classes (As far as I can tell, MethodMembers().That().AreDeclaredIn() only accepts Types but Types cant be abstract (Is there to get types from classes?))
  2. Finding all classes that inherit those abstract classes

The second point is more important because if all abstract classes are inherited, I can be sure that all abstract methods are overridden.

Metadata

Metadata

Labels

kind/supportCategorizes issue or PR as a support question.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions