public void TestInit() {
     _userId = Guid.NewGuid().ToString();
     _resourceUri = "a";
     _roleId = "b";
     CreateMockSecurityManager();
     _permissionManager = new PermissionManager( CreateIdentity(), _mockSecurityManager );
 }
 public void Test_IdentityIsNull() {
     _permissionManager = new PermissionManager( null, _mockSecurityManager );
     _permissionManager.HasPermission( _resourceUri ).Returns( t => { throw new ArgumentNullException( "identity" ); } );
 }
 public void Test_Ignore() {
     _mockSecurityManager.GetPermissionsByResource( _resourceUri )
         .Returns( new ResourcePermissions( _resourceUri, new List<Permission> { new Permission( _roleId, true ) } ) );
     _permissionManager = new PermissionManager( CreateIdentity(), _mockSecurityManager,true );
     AssertTrue();
 }
 public void Test_InvalidUserId() {
     _userId = "";
     _mockSecurityManager.IsInApplication( _userId ).Returns( true );
     _permissionManager = new PermissionManager( CreateIdentity(), _mockSecurityManager );
     AssertFalse();
 }
 public void Test_IsAuthenticated() {
     _permissionManager = new PermissionManager( CreateIdentity( false ), _mockSecurityManager );
     AssertFalse();
 }
 public void Test_SecurityManagerIsNull() {
     _permissionManager = new PermissionManager( CreateIdentity(), null );
     _permissionManager.HasPermission( _resourceUri ).Returns( t => { throw new ArgumentNullException( "securityManager" ); } );
 }