private static void AssertSetterSets(string propertyName)
        {
            const string test     = "test";
            var          property = typeof(ResourceAuthorizeAttribute).GetProperty(propertyName);

            Assert.AreEqual(typeof(string), property.PropertyType);
            var attribute            = new ResourceAuthorizeAttribute();
            var initialPropertyValue = (string)property.GetValue(attribute);

            Assert.IsTrue(string.IsNullOrWhiteSpace(initialPropertyValue), "string.IsNullOrWhiteSpace(initialPropertyValue)");
            property.SetValue(attribute, test);
            var newPropertyValue = property.GetValue(attribute);

            Assert.AreEqual(test, newPropertyValue);
        }
        public void UserShouldNotBeAuthorized()
        {
            using (var request = new HttpRequestMessage())
            {
                var controllerContext = CreateControllerContext(request);
                var actionContext     = CreateActionContext(controllerContext);

                try
                {
                    var attribute = new ResourceAuthorizeAttribute();
                    attribute.OnAuthorization(actionContext);
                    Assert.AreEqual(HttpStatusCode.Unauthorized, actionContext.Response.StatusCode);
                }
                finally
                {
                    actionContext.Response?.Dispose();
                }
            }
        }
        public void OnAuthorizationShouldThrowWhenFilterContextIsNull()
        {
            var attribute = new ResourceAuthorizeAttribute();

            attribute.OnAuthorization(null);
        }