@@ -30,7 +30,7 @@ public void Does_get_Single_TypeId_Attribute()
3030 }
3131
3232 [ Test ]
33- public void Does_get_Multiple_Default_Attributes ( )
33+ public void Does_get_Multiple_RouteDefault_Attributes ( )
3434 {
3535 // AllAttributes<T>() makes this call to get attrs
3636 var referenceGeneric =
@@ -86,6 +86,26 @@ public void Does_get_Multiple_Default_Attributes()
8686 } ) ) ;
8787 }
8888
89+ [ Test ]
90+ public void Does_get_Multiple_Route_Attributes ( )
91+ {
92+ var routeAttrs = typeof ( DefaultWithMultipleRouteAttributes )
93+ . AllAttributes < RouteAttribute > ( ) ;
94+
95+ Assert . That ( routeAttrs . Length , Is . EqualTo ( 4 ) ) ;
96+
97+ var values = routeAttrs . ToList ( ) . ConvertAll ( x => "{0}:{1}" . Fmt ( x . Path , x . Verbs ) ) ;
98+
99+ Assert . That ( values , Is . EquivalentTo ( new [ ] {
100+ "/path:" , "/path/2:" , "/path:GET" , "/path:POST" ,
101+ } ) ) ;
102+
103+ var inheritedRouteAttrs = typeof ( DefaultWithMultipleRouteAttributes )
104+ . AllAttributes < InheritedRouteAttribute > ( ) ;
105+
106+ Assert . That ( inheritedRouteAttrs . Length , Is . EqualTo ( 2 ) ) ;
107+ }
108+
89109 [ Test ]
90110 public void Does_get_Multiple_TypeId_Attributes ( )
91111 {
@@ -200,9 +220,15 @@ public class DefaultWithSingleAttribute { }
200220
201221 [ RouteDefault ( "/path" ) ]
202222 [ RouteDefault ( "/path/2" ) ]
223+ [ InheritedRouteDefault ( "/path" , "GET" ) ]
224+ [ InheritedRouteDefault ( "/path" , "POST" ) ]
225+ public class DefaultWithMultipleAttributes { }
226+
227+ [ Route ( "/path" ) ]
228+ [ Route ( "/path/2" ) ]
203229 [ InheritedRoute ( "/path" , "GET" ) ]
204230 [ InheritedRoute ( "/path" , "POST" ) ]
205- public class DefaultWithMultipleAttributes { }
231+ public class DefaultWithMultipleRouteAttributes { }
206232
207233 [ AttributeUsage ( AttributeTargets . Class | AttributeTargets . Method , AllowMultiple = true , Inherited = true ) ]
208234 public class RouteTypeIdAttribute : Attribute
@@ -232,13 +258,13 @@ public override string ToString()
232258 }
233259 }
234260
235- public class InheritedRouteAttribute : RouteDefaultAttribute {
236- public InheritedRouteAttribute ( string path )
261+ public class InheritedRouteDefaultAttribute : RouteDefaultAttribute {
262+ public InheritedRouteDefaultAttribute ( string path )
237263 : base ( path )
238264 {
239265 }
240266
241- public InheritedRouteAttribute ( string path , string verbs )
267+ public InheritedRouteDefaultAttribute ( string path , string verbs )
242268 : base ( path , verbs )
243269 {
244270 }
@@ -287,4 +313,19 @@ public override int GetHashCode()
287313 }
288314 }
289315
316+ public class InheritedRouteAttribute : RouteAttribute
317+ {
318+ public InheritedRouteAttribute ( string path )
319+ : base ( path )
320+ {
321+ }
322+
323+ public InheritedRouteAttribute ( string path , string verbs )
324+ : base ( path , verbs )
325+ {
326+ }
327+
328+ public string Custom { get ; set ; }
329+ }
330+
290331}
0 commit comments