public async Task Then_If_There_Is_An_Error_A_Bad_Request_Is_Returned(
            Guid employerDemandId,
            [Frozen] Mock <IMediator> mockMediator,
            [Greedy] DemandController controller)
        {
            mockMediator
            .Setup(mediator => mediator.Send(
                       It.IsAny <AnonymiseDemandCommand>(),
                       It.IsAny <CancellationToken>())).ThrowsAsync(new Exception());

            var controllerResult = await controller.AnonymiseEmployerDemand(employerDemandId) as StatusCodeResult;

            controllerResult !.StatusCode.Should().Be((int)HttpStatusCode.InternalServerError);
        }
        public async Task Then_The_Command_Is_Processed_By_Mediator(
            Guid employerDemandId,
            [Frozen] Mock <IMediator> mockMediator,
            [Greedy] DemandController controller)
        {
            mockMediator
            .Setup(mediator => mediator.Send(
                       It.Is <AnonymiseDemandCommand>(command => command.EmployerDemandId == employerDemandId),
                       It.IsAny <CancellationToken>()))
            .ReturnsAsync(Unit.Value);

            var controllerResult = await controller.AnonymiseEmployerDemand(employerDemandId) as OkResult;

            controllerResult !.StatusCode.Should().Be((int)HttpStatusCode.OK);
        }
        public async Task Then_If_There_Is_A_HttpException_It_Is_Returned(
            string errorContent,
            Guid employerDemandId,
            [Frozen] Mock <IMediator> mockMediator,
            [Greedy] DemandController controller)
        {
            mockMediator
            .Setup(mediator => mediator.Send(
                       It.IsAny <AnonymiseDemandCommand>(),
                       It.IsAny <CancellationToken>()))
            .ThrowsAsync(new HttpRequestContentException("Error", HttpStatusCode.BadRequest, errorContent));

            var controllerResult = await controller.AnonymiseEmployerDemand(employerDemandId) as ObjectResult;

            controllerResult !.StatusCode.Should().Be((int)HttpStatusCode.BadRequest);
            controllerResult.Value.Should().Be(errorContent);
        }