1
1
using System ;
2
+ using Microsoft . AspNetCore . Mvc ;
2
3
using SharpGrip . FluentValidation . AutoValidation . Mvc . Attributes ;
3
4
using SharpGrip . FluentValidation . AutoValidation . Shared . Extensions ;
4
5
using Xunit ;
@@ -46,11 +47,38 @@ public void Test_HasCustomAttribute()
46
47
Assert . False ( typeof ( TestModelRecord ) . HasCustomAttribute < AutoValidationAttribute > ( ) ) ;
47
48
}
48
49
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
+
49
65
[ AutoValidation ]
50
66
private class TestModelClass ;
51
67
52
68
[ AutoValidateNever ]
53
69
private record TestModelRecord ;
54
70
55
71
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 ;
56
84
}
0 commit comments