Fix for issue #349
This commit is contained in:
parent
3db0a80306
commit
383c6305e1
|
|
@ -3,10 +3,18 @@
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Mvc
|
namespace Microsoft.AspNet.Mvc
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Contains constant values for known filter scopes.
|
||||||
|
///
|
||||||
|
/// Scope defines the ordering of filters that have the same order. Scope is by-default
|
||||||
|
/// defined by how a filter is registered.
|
||||||
|
/// </summary>
|
||||||
public static class FilterScope
|
public static class FilterScope
|
||||||
{
|
{
|
||||||
public static readonly int Action = 100;
|
public static readonly int First = 0;
|
||||||
public static readonly int Controller = 200;
|
public static readonly int Global = 10;
|
||||||
public static readonly int Global = 300;
|
public static readonly int Controller = 20;
|
||||||
|
public static readonly int Action = 30;
|
||||||
|
public static readonly int Last = 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ namespace Microsoft.AspNet.Mvc.Test
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(3, descriptor.FilterDescriptors.Count);
|
Assert.Equal(3, descriptor.FilterDescriptors.Count);
|
||||||
|
|
||||||
var filter1 = descriptor.FilterDescriptors[2];
|
var filter1 = descriptor.FilterDescriptors[0];
|
||||||
Assert.Same(globalFilter, filter1.Filter);
|
Assert.Same(globalFilter, filter1.Filter);
|
||||||
Assert.Equal(FilterScope.Global, filter1.Scope);
|
Assert.Equal(FilterScope.Global, filter1.Scope);
|
||||||
|
|
||||||
|
|
@ -53,7 +53,7 @@ namespace Microsoft.AspNet.Mvc.Test
|
||||||
Assert.Equal(2, Assert.IsType<MyFilterAttribute>(filter2.Filter).Value);
|
Assert.Equal(2, Assert.IsType<MyFilterAttribute>(filter2.Filter).Value);
|
||||||
Assert.Equal(FilterScope.Controller, filter2.Scope);
|
Assert.Equal(FilterScope.Controller, filter2.Scope);
|
||||||
|
|
||||||
var filter3 = descriptor.FilterDescriptors[0];
|
var filter3 = descriptor.FilterDescriptors[2];
|
||||||
Assert.Equal(3, Assert.IsType<MyFilterAttribute>(filter3.Filter).Value); ;
|
Assert.Equal(3, Assert.IsType<MyFilterAttribute>(filter3.Filter).Value); ;
|
||||||
Assert.Equal(FilterScope.Action, filter3.Scope);
|
Assert.Equal(FilterScope.Action, filter3.Scope);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue