Пример #1
0
 public void GetDisplayNameReturnsNullForUsersWithoutDisplayNameClaim()
 {
     var principal = new ClaimsPrincipal();
     var result = principal.GetDisplayName();
     Assert.Null(result);
 }
Пример #2
0
        public void GetDisplayNameReturnsCorrectDisplayNameForUsersWithDisplayNameClaim()
        {
            const string displayName = "FirstName LastName";
            var principal = new ClaimsPrincipal(new ClaimsIdentity(new[]
            {
                new Claim(ClaimTypes.Name, "FirstNameLastName"),
                new Claim(AllReady.Security.ClaimTypes.DisplayName, displayName)
            }));

            var result = principal.GetDisplayName();
            Assert.Equal(displayName, result);
        }