Example #1
0
            public void WhenNoAdminRoleClaim_ReturnsFalse()
            {
                var user      = new User("admin");
                var principal = Fakes.ToPrincipal(user);

                Assert.False(PrincipalExtensions.IsAdministrator(principal));
            }
Example #2
0
            public void WhenAdminRoleClaim_ReturnsTrue()
            {
                var user = new User("admin")
                {
                    Roles = new [] { new Role {
                                         Key = 1, Name = "Admins"
                                     } }
                };
                var principal = Fakes.ToPrincipal(user);

                Assert.True(PrincipalExtensions.IsAdministrator(principal));
            }
Example #3
0
 public void WhenSelfIsNull_ReturnsFalse()
 {
     Assert.False(PrincipalExtensions.IsAdministrator(null));
 }