public async Task Then_If_Error_Then_Internal_Server_Error_Returned(
            string vacancyReference,
            GetVacancyQueryResult queryResult,
            [Frozen] Mock <IMediator> mockMediator,
            [Greedy] VacancyController controller)
        {
            mockMediator.Setup(x => x.Send(It.IsAny <GetVacancyQuery>(),
                                           CancellationToken.None)).ThrowsAsync(new Exception());

            var controllerResult = await controller.GetVacancy(vacancyReference) as StatusCodeResult;

            Assert.IsNotNull(controllerResult);
            controllerResult.StatusCode.Should().Be((int)HttpStatusCode.InternalServerError);
        }
        public async Task Then_If_No_Result_Then_Not_Found_Result_Returned(
            string vacancyReference,
            GetVacancyQueryResult queryResult,
            [Frozen] Mock <IMediator> mockMediator,
            [Greedy] VacancyController controller)
        {
            queryResult.Vacancy = null;
            mockMediator.Setup(x => x.Send(It.Is <GetVacancyQuery>(c =>
                                                                   c.VacancyReference.Equals(vacancyReference)),
                                           CancellationToken.None)).ReturnsAsync(queryResult);

            var controllerResult = await controller.GetVacancy(vacancyReference) as NotFoundResult;

            Assert.IsNotNull(controllerResult);
            controllerResult.StatusCode.Should().Be((int)HttpStatusCode.NotFound);
        }
        public async Task Then_The_Handler_Is_Called_And_Data_Returned(
            string vacancyReference,
            GetVacancyQueryResult queryResult,
            [Frozen] Mock <IMediator> mockMediator,
            [Greedy] VacancyController controller)
        {
            mockMediator.Setup(x => x.Send(It.Is <GetVacancyQuery>(c =>
                                                                   c.VacancyReference.Equals(vacancyReference)),
                                           CancellationToken.None)).ReturnsAsync(queryResult);

            var controllerResult = await controller.GetVacancy(vacancyReference) as ObjectResult;

            Assert.IsNotNull(controllerResult);
            controllerResult.StatusCode.Should().Be((int)HttpStatusCode.OK);
            var model = controllerResult.Value as GetVacancyResponse;

            Assert.IsNotNull(model);
            model.Should().BeEquivalentTo((GetVacancyResponse)queryResult);
        }