Inheritance: System.Web.Mvc.ActionFilterAttribute, IAuthenticationFilter
 public void ShouldDoNothingOnAuthenticationChallenge()
 {
     var authChallengeContext = new Mock<AuthenticationChallengeContext>();
     var attribute = new BlogAuthorizationAttribute();
     
     Assert.DoesNotThrow(() => attribute.OnAuthenticationChallenge(authChallengeContext.Object));
 }
        public void ShouldReturnUnauthorizedWhenNotAuthenticated()
        {
            _requestBase.SetupGet(r => r.IsAuthenticated).Returns(false);

            var attribute = new BlogAuthorizationAttribute();
            attribute.OnAuthentication(_authenticationContext.Object);

            Assert.IsInstanceOf(typeof(HttpUnauthorizedResult), _authenticationContext.Object.Result);
        }
        public void ShouldReturnNullWhenUserAuthenticated()
        {
            _requestBase.SetupGet(r => r.IsAuthenticated).Returns(true);

            var attribute = new BlogAuthorizationAttribute();
            attribute.OnAuthentication(_authenticationContext.Object);

            Assert.IsNull(_authenticationContext.Object.Result);
        }