public async Task AcceptCandidatureAsync_ShouldBeOfTypeOkObjectResult()
        {
            // Arrange
            TestMock.CandidatureService.Setup(clanService => clanService.FindCandidatureAsync(It.IsAny <CandidatureId>()))
            .ReturnsAsync(new Candidature(new UserId(), new ClanId()))
            .Verifiable();

            TestMock.CandidatureService.Setup(clanService => clanService.AcceptCandidatureAsync(It.IsAny <Candidature>(), It.IsAny <UserId>()))
            .ReturnsAsync(new DomainValidationResult <Candidature>())
            .Verifiable();

            var candidatureController = new CandidaturesController(TestMock.CandidatureService.Object, TestMapper)
            {
                ControllerContext =
                {
                    HttpContext = MockHttpContextAccessor.GetInstance()
                }
            };

            // Act
            var result = await candidatureController.AcceptCandidatureAsync(new CandidatureId());

            // Assert
            result.Should().BeOfType <OkObjectResult>();

            TestMock.CandidatureService.Verify(clanService => clanService.FindCandidatureAsync(It.IsAny <CandidatureId>()), Times.Once);

            TestMock.CandidatureService.Verify(clanService => clanService.AcceptCandidatureAsync(It.IsAny <Candidature>(), It.IsAny <UserId>()), Times.Once);
        }
        public async Task SendCandidatureAsync_ShouldBeOfTypeBadRequestObjectResult()
        {
            // Arrange
            TestMock.CandidatureService.Setup(clanService => clanService.SendCandidatureAsync(It.IsAny <UserId>(), It.IsAny <ClanId>()))
            .ReturnsAsync(DomainValidationResult <Candidature> .Failure("Error"))
            .Verifiable();

            var candidatureController = new CandidaturesController(TestMock.CandidatureService.Object, TestMapper)
            {
                ControllerContext =
                {
                    HttpContext = MockHttpContextAccessor.GetInstance()
                }
            };

            // Act
            var result = await candidatureController.SendCandidatureAsync(
                new SendCandidatureRequest
            {
                ClanId = new ClanId(),
                UserId = new UserId()
            });

            // Assert
            result.Should().BeOfType <BadRequestObjectResult>();

            TestMock.CandidatureService.Verify(clanService => clanService.SendCandidatureAsync(It.IsAny <UserId>(), It.IsAny <ClanId>()), Times.Once);
        }
        public async Task FetchCandidaturesAsync_WithNullParameters_ShouldBeOfTypeBadRequestObjectResult()
        {
            // Arrange
            var candidatureController = new CandidaturesController(TestMock.CandidatureService.Object, TestMapper);

            // Act
            var result = await candidatureController.FetchCandidaturesAsync();

            // Assert
            result.Should().BeOfType <BadRequestObjectResult>();
        }
        public async Task FindCandidatureAsync_ShouldBeOfTypeOkContentResult()
        {
            // Arrange
            TestMock.CandidatureService.Setup(candidatureService => candidatureService.FindCandidatureAsync(It.IsAny <CandidatureId>()))
            .ReturnsAsync(new Candidature(new UserId(), new ClanId()))
            .Verifiable();

            var candidatureController = new CandidaturesController(TestMock.CandidatureService.Object, TestMapper);

            // Act
            var result = await candidatureController.FindCandidatureAsync(new CandidatureId());

            // Assert
            result.Should().BeOfType <OkObjectResult>();

            TestMock.CandidatureService.Verify(clanService => clanService.FindCandidatureAsync(It.IsAny <CandidatureId>()), Times.Once);
        }
        public async Task FetchCandidaturesAsync_WithUserId_ShouldBeOfTypeNoContentResult()
        {
            // Arrange
            TestMock.CandidatureService.Setup(candidatureService => candidatureService.FetchCandidaturesAsync(It.IsAny <UserId>()))
            .ReturnsAsync(new List <Candidature>())
            .Verifiable();

            var candidatureController = new CandidaturesController(TestMock.CandidatureService.Object, TestMapper);

            // Act
            var result = await candidatureController.FetchCandidaturesAsync(null, new UserId());

            // Assert
            result.Should().BeOfType <NoContentResult>();

            TestMock.CandidatureService.Verify(clanService => clanService.FetchCandidaturesAsync(It.IsAny <UserId>()), Times.Once);
        }