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)); }
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)); }
public async Task ArgNull() { var service = new DefaultPrincipalIdGetter(); await Assert.ThrowsAsync <ArgumentNullException>(() => service.GetPrincipalIdAsync(null)); }