public void GetCustomAttributes() { // Arrange ReflectedAsyncActionDescriptor ad = GetActionDescriptor(_asyncMethod, _completedMethod); // Act object[] attributes = ad.GetCustomAttributes(true /* inherit */); // Assert Assert.AreEqual(1, attributes.Length); Assert.AreEqual(typeof(AuthorizeAttribute), attributes[0].GetType()); }
public void GetCustomAttributes_FilterByType() { // Shouldn't match attributes on the Completed() method, only the Async() method // Arrange ReflectedAsyncActionDescriptor ad = GetActionDescriptor(_asyncMethod, _completedMethod); // Act object[] attributes = ad.GetCustomAttributes(typeof(OutputCacheAttribute), true /* inherit */); // Assert Assert.AreEqual(0, attributes.Length); }
public void GetCustomAttributes() { // Arrange ReflectedAsyncActionDescriptor ad = GetActionDescriptor(_asyncMethod, _completedMethod); // Act object[] attributes = ad.GetCustomAttributes(true /* inherit */); // Assert object attribute = Assert.Single(attributes); Assert.IsType <AuthorizeAttribute>(attribute); }