public void GetCustomAttributesFilterByType() { // Should not match attributes on the EndFoo() method, only the BeginFoo() method // Arrange ReflectedAsyncPatternActionDescriptor ad = new ReflectedAsyncPatternActionDescriptor(_validBeginMethod, _validEndMethod, "SomeAction", new Mock<ControllerDescriptor>().Object); // Act object[] attributes = ad.GetCustomAttributes(typeof(OutputCacheAttribute), true /* inherit */); // Assert Assert.AreEqual(0, attributes.Length); }
public void GetCustomAttributes() { // Arrange ReflectedAsyncPatternActionDescriptor ad = new ReflectedAsyncPatternActionDescriptor(_validBeginMethod, _validEndMethod, "SomeAction", new Mock<ControllerDescriptor>().Object); // Act object[] attributes = ad.GetCustomAttributes(true /* inherit */); // Assert Assert.AreEqual(1, attributes.Length); Assert.IsInstanceOfType(attributes[0], typeof(AuthorizeAttribute)); }