Esempio n. 1
0
        public void CanExecute_IsAuthorized_ReturnsCanExecuteFunc()
        {
            // Arrange
            Thread.CurrentPrincipal = new GenericPrincipal(new GenericIdentity("SomeUser"), new string[] { "Role1" });
            var command = new SecureRelayCommand(AllowRoleMethod, x => false);

            // Act
            var result = command.CanExecute(null);

            // Assert
            Assert.IsFalse(result);
        }
Esempio n. 2
0
        public void CanExecute_DenyRoleSatisfied_ReturnsTrue()
        {
            // Arrange
            Thread.CurrentPrincipal = new GenericPrincipal(new GenericIdentity("SomeUser"), new string[] {});
            var command = new SecureRelayCommand(DenyRoleMethod, x => true);

            // Act
            var result = command.CanExecute(null);

            // Assert
            Assert.IsTrue(result);
        }