public void RequiresClaimWithValues_UserClaimWithAllValues_ReturnsContinue()
        {
            var attr        = new RequiresClaimWithValuesAttribute("a", "1", "2", "3");
            var user        = UserSetup.GetUserWithClaims("a:1", "a:2", "a:3");
            var httpContext = new Fakes.FakeHttpContext();

            httpContext.User = user;
            var shouldContinue = attr.ShouldContinue(httpContext);

            Assert.True(shouldContinue.ShouldContinue);
        }
        public void RequiresClaimWithValues_UserClaimWithSomeValues_ReturnsUnauthorized()
        {
            var attr        = new RequiresClaimWithValuesAttribute("a", "1", "2", "3");
            var user        = UserSetup.GetUserWithClaims("a:1", "a:2");
            var httpContext = new Fakes.FakeHttpContext();

            httpContext.User = user;
            var shouldContinue = attr.ShouldContinue(httpContext);

            Assert.False(shouldContinue.ShouldContinue);
            Assert.Equal(ApiFilterRunResult.Unauthorized.SetResponseCode, shouldContinue.SetResponseCode);
        }
        public void RequiresClaimWithValues_UnauthenticatedUser_ReturnsUnauthenticated()
        {
            var attr        = new RequiresClaimWithValuesAttribute("a", "1", "2", "3");
            var user        = new ClaimsPrincipal();
            var httpContext = new Fakes.FakeHttpContext();

            httpContext.User = user;
            var shouldContinue = attr.ShouldContinue(httpContext);

            Assert.False(shouldContinue.ShouldContinue);
            Assert.Equal(ApiFilterRunResult.Unauthenticated.SetResponseCode, shouldContinue.SetResponseCode);
        }