11using System ;
2+ using Microsoft . AspNetCore . Mvc ;
23using SharpGrip . FluentValidation . AutoValidation . Mvc . Attributes ;
34using SharpGrip . FluentValidation . AutoValidation . Shared . Extensions ;
45using Xunit ;
@@ -46,11 +47,38 @@ public void Test_HasCustomAttribute()
4647 Assert . False ( typeof ( TestModelRecord ) . HasCustomAttribute < AutoValidationAttribute > ( ) ) ;
4748 }
4849
50+ [ Fact ]
51+ public void Test_InheritsFromTypeWithNameEndingIn ( )
52+ {
53+ Assert . True ( typeof ( TestInherits1 ) . InheritsFromTypeWithNameEndingIn ( "Controller" ) ) ;
54+ Assert . True ( typeof ( TestInherits1 ) . InheritsFromTypeWithNameEndingIn ( "controller" ) ) ;
55+ Assert . True ( typeof ( TestInherits2 ) . InheritsFromTypeWithNameEndingIn ( "Controller" ) ) ;
56+ Assert . True ( typeof ( TestInherits2 ) . InheritsFromTypeWithNameEndingIn ( "controller" ) ) ;
57+ Assert . False ( typeof ( TestInherits3 ) . InheritsFromTypeWithNameEndingIn ( "Controller" ) ) ;
58+ Assert . False ( typeof ( TestInherits3 ) . InheritsFromTypeWithNameEndingIn ( "controller" ) ) ;
59+ Assert . False ( typeof ( TestInherits4 ) . InheritsFromTypeWithNameEndingIn ( "Controller" ) ) ;
60+ Assert . False ( typeof ( TestInherits4 ) . InheritsFromTypeWithNameEndingIn ( "controller" ) ) ;
61+ Assert . False ( typeof ( TestInherits5 ) . InheritsFromTypeWithNameEndingIn ( "Controller" ) ) ;
62+ Assert . False ( typeof ( TestInherits5 ) . InheritsFromTypeWithNameEndingIn ( "controller" ) ) ;
63+ }
64+
4965 [ AutoValidation ]
5066 private class TestModelClass ;
5167
5268 [ AutoValidateNever ]
5369 private record TestModelRecord ;
5470
5571 private enum TestModelEnum ;
72+
73+ private class TestInherits1 : Controller ;
74+
75+ private class TestInherits2 : CustomControllerBase ;
76+
77+ private class TestInherits3 : ControllerBase ;
78+
79+ private class TestInherits4 : ActionContext ;
80+
81+ private class TestInherits5 : object ;
82+
83+ private class CustomControllerBase : Controller ;
5684}
0 commit comments