Пример #1
0
        public async Task NoNameThrows()
        {
            var service = new DefaultPrincipalIdGetter();

            var principal = new ClaimsPrincipal(new ClaimsIdentity(new List <Claim> {
            }, "scheme", "NameType", ClaimTypes.Role));
            await Assert.ThrowsAsync <ArgumentException>(() => service.GetPrincipalIdAsync(principal));
        }
Пример #2
0
        public async Task DefaultOrder(ClaimsPrincipal principal, string expectedName)
        {
            var service = new DefaultPrincipalIdGetter();

            Assert.Equal(expectedName, await service.GetPrincipalIdAsync(principal));

            principal = new ClaimsPrincipal(new ClaimsIdentity(new List <Claim> {
            }, "scheme", "NameType", ClaimTypes.Role));
            await Assert.ThrowsAsync <ArgumentException>(() => service.GetPrincipalIdAsync(principal));
        }
Пример #3
0
        public async Task ArgNull()
        {
            var service = new DefaultPrincipalIdGetter();

            await Assert.ThrowsAsync <ArgumentNullException>(() => service.GetPrincipalIdAsync(null));
        }