How to add claims in a mock ClaimsPrincipal
You don’t need to mock ClaimsPrincipal it has no outside dependencies and you can created it un-mocked: var claims = new List<Claim>() { new Claim(ClaimTypes.Name, “username”), new Claim(ClaimTypes.NameIdentifier, “userId”), new Claim(“name”, “John Doe”), }; var identity = new ClaimsIdentity(claims, “TestAuthType”); var claimsPrincipal = new ClaimsPrincipal(identity); And I’m not sure what you are testing here. Certainly … Read more