コード例 #1
0
        public void HasClaimsReturnsExpectedResult(IEnumerable<Claim> claims, bool expected)
        {
            var principalClaims = new List<Claim>
            {
                new Claim("one", "one"),
                new Claim("two", "two")
            };

            var sut = new ClaimsPrincipal(new ClaimsIdentity(principalClaims));

            Assert.Equal(expected, sut.HasClaims(claims));
        }
コード例 #2
0
        public void HasClaimsWithNullClaimsThrowsArgumentNullException()
        {
            var sut = new ClaimsPrincipal();

            var ex = Assert.Throws<ArgumentNullException>(() => sut.HasClaims(null));
            Assert.Equal("claims", ex.ParamName);
        }