public async Task HasPermissionForActivity_BoardUserExists_ReturnOutputOfIBoardUserPermissionService()
        {
            var userId = "user-id";

            _currentUser.Setup(u => u.UserId).Returns(userId);
            _boardUserPermissionService.Setup(s => s.HasPermission(It.IsAny <BoardUser>(), It.IsAny <BoardUserPermission>())).Returns(true);

            var dbName = $"{nameof(CurrentUserPermissionServiceTests)}_{nameof(HasPermissionForActivity_BoardUserExists_ReturnOutputOfIBoardUserPermissionService)}";

            using var context = TestApplicationDbContext.Create(dbName);
            var cancellationToken = new CancellationToken();
            var boardFactory      = new BoardFactory();
            var board             = boardFactory.Create("board-title");
            var card      = Card.Create("card-title");
            var activity  = Activity.Create("activity-title");
            var boardUser = new BoardUserFactory().CreateOwner(1, userId);

            board.AddCard(card);
            card.AddActivity(activity);
            context.Boards.Add(board);
            context.BoardUsers.Add(boardUser);
            await context.SaveChangesAsync(cancellationToken);

            var service = new CurrentUserPermissionService(context, _currentUser.Object, _boardUserPermissionService.Object);

            var result = await service.HasPermissionForActivity(activity.Id, BoardUserPermission.CAN_VIEW_ACTIVITY, cancellationToken);

            Assert.True(result);
        }
        public async Task HasPermissionForActivity_ActivityNotExists_ThrowNotFoundApplicationException()
        {
            var dbName  = $"{nameof(CurrentUserPermissionServiceTests)}_{nameof(HasPermissionForActivity_ActivityNotExists_ThrowNotFoundApplicationException)}";
            var context = TestApplicationDbContext.Create(dbName);
            var service = new CurrentUserPermissionService(context, _currentUser.Object, _boardUserPermissionService.Object);

            Task action() => service.HasPermissionForActivity(1, BoardUserPermission.CAN_VIEW_ACTIVITY, new CancellationToken());

            await Assert.ThrowsAsync <NotFoundApplicationException>(action);
        }
        public async Task HasPermissionForBoard_BoardUserNotExists_ReturnFalse()
        {
            var dbName = $"{nameof(CurrentUserPermissionServiceTests)}_{nameof(HasPermissionForBoard_BoardUserNotExists_ReturnFalse)}";

            using var context = TestApplicationDbContext.Create(dbName);
            var cancellationToken = new CancellationToken();
            var boardFactory      = new BoardFactory();
            var board             = boardFactory.Create("board-title");

            context.Boards.Add(board);
            await context.SaveChangesAsync(cancellationToken);

            var userId = "user-id";

            _currentUser.Setup(u => u.UserId).Returns(userId);

            var service = new CurrentUserPermissionService(context, _currentUser.Object, _boardUserPermissionService.Object);

            var result = await service.HasPermissionForBoard(board.Id, BoardUserPermission.CAN_VIEW_BOARD, cancellationToken);

            Assert.False(result);
        }