public async Task GetMembershipByIdQueryHandler_ShouldReturnMembership_WhenMembershipExists()
        {
            // Arrange
            GetMembershipByIdQuery request = new GetMembershipByIdQuery {
                GroupMembershipId = 1
            };

            IEnumerable <GroupMembership> expectedMemberships = new[]
            {
                new GroupMembership {
                    GroupMembershipId = 1
                }
            };

            IQueryable <GroupMembership> queryableMock = expectedMemberships
                                                         .AsQueryable()
                                                         .BuildMock()
                                                         .Object;

            _unitOfWorkMock
            .Setup(m => m.GroupMemberships.GetById(request.GroupMembershipId))
            .Returns(queryableMock);

            GetMembershipByIdQuery.Handler handler = new GetMembershipByIdQuery.Handler(_mapperMock, _unitOfWorkMock.Object);

            // Act
            GroupMembershipResource membership = await handler.Handle(request);

            // Assert
            Assert.NotNull(membership);
            Assert.Equal(request.GroupMembershipId, membership.GroupMembershipId);
        }
        public async Task GetMembershipByIdQueryHandler_ShouldReturnNull_WhenMembershipDoesNotExist()
        {
            // Arrange
            GetMembershipByIdQuery request = new GetMembershipByIdQuery {
                GroupMembershipId = 1
            };

            IQueryable <GroupMembership> expectedMemberships = Enumerable
                                                               .Empty <GroupMembership>()
                                                               .AsQueryable()
                                                               .BuildMock()
                                                               .Object;

            _unitOfWorkMock
            .Setup(m => m.GroupMemberships.GetById(request.GroupMembershipId))
            .Returns(expectedMemberships);

            GetMembershipByIdQuery.Handler handler = new GetMembershipByIdQuery.Handler(_mapperMock, _unitOfWorkMock.Object);

            // Act
            GroupMembershipResource membership = await handler.Handle(request);

            // Assert
            Assert.Null(membership);
        }