Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Urganot opened this issue Nov 27, 2024 · 0 comments
Open

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

Urganot opened this issue Nov 27, 2024 · 0 comments

Comments

@Urganot
Copy link

Urganot commented Nov 27, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant