예제 #1
0
        public void delete_post_returns_json()
        {
            //Arrange
            _serv       = new Mock <IEmployerService>();
            _controller = new EmployerController(_serv.Object, _defaults.Object, map, _adaptor.Object);

            //Act
            var result = _controller.Delete(testId, "UnitTest");

            //Assert
            Assert.AreEqual("{ status = OK, jobSuccess = True, deletedID = 4242 }",
                            result.Value.ToString());
        }
        public void PostEmployer_Success()
        {
            var service = new Mock <IEmployerService>();

            service.Setup(S => S.CreateEmployer(It.IsAny <EmployerCreate>())).Returns(true);
            var controller = new EmployerController(service.Object);

            var model = new EmployerCreate();

            var result = controller.Post(model);

            Assert.IsInstanceOfType(result, typeof(OkResult));
        }
        public void PostEmployer_Failure_CreateEmployerFailed()
        {
            var service = new Mock <IEmployerService>();

            service.Setup(S => S.CreateEmployer(It.IsAny <EmployerCreate>())).Returns(false);
            var controller = new EmployerController(service.Object);

            var model = new EmployerCreate();

            var result = controller.Post(model);

            Assert.IsInstanceOfType(result, typeof(InternalServerErrorResult));
        }
        public void Setup()
        {
            _mockMediator         = new Mock <IMediator>();
            _employerOrchestrator = new EmployerOrchestrator(_mockMediator.Object, Mock.Of <ICommitmentsLogger>(), new FacetMapper(Mock.Of <ICurrentDateTime>()), new ApprenticeshipFilterService(new FacetMapper(Mock.Of <ICurrentDateTime>())), Mock.Of <IApprenticeshipMapper>(), Mock.Of <ICommitmentMapper>());

            _apprenticeshipsOrchestrator = new ApprenticeshipsOrchestrator(
                _mockMediator.Object,
                Mock.Of <IDataLockMapper>(),
                Mock.Of <IApprenticeshipMapper>(),
                Mock.Of <ICommitmentsLogger>());

            _controller = new EmployerController(_employerOrchestrator, _apprenticeshipsOrchestrator);
        }
예제 #5
0
        private static EmployerController BuildEmployerController(
            IEmailService emailService = null)
        {
            emailService ??= Substitute.For <IEmailService>();

            var controller = new EmployerController(emailService)
            {
                ControllerContext = new ControllerContext {
                    HttpContext = new DefaultHttpContext()
                }
            };

            return(controller);
        }
예제 #6
0
        public async Task ThenMadeRedundantIsMapped(GetApprenticeshipResponse mediatorResponse)
        {
            _mockMediator.Setup(x => x.SendAsync(It.IsAny <GetApprenticeshipRequest>())).ReturnsAsync(mediatorResponse);

            // for this unit test we want a controller where the employerOrchestrator contains a real ApprenticeshipMapper
            _employerOrchestrator = new EmployerOrchestrator(_mockMediator.Object, Mock.Of <ICommitmentsLogger>(), new FacetMapper(Mock.Of <ICurrentDateTime>()), new ApprenticeshipFilterService(new FacetMapper(Mock.Of <ICurrentDateTime>())),
                                                             new ApprenticeshipMapper(), _commitmentMapper.Object, Mock.Of <ITransferRequestMapper>(), Mock.Of <IHashingService>());

            _controller = new EmployerController(_employerOrchestrator, _apprenticeshipsOrchestrator);

            var result = await _controller.GetApprenticeship(TestProviderId, TestApprenticeshipId) as OkNegotiatedContentResult <Apprenticeship.Apprenticeship>;

            result.Content.Should().NotBeNull();
            Assert.AreEqual(mediatorResponse.Data.MadeRedundant, result.Content.MadeRedundant);
        }
예제 #7
0
        public async Task Then_Result_Is_Not_Null(
            Domain.Models.Opportunity opportunity,
            IEmployerService employerService,
            EmployerController sut,
            [Frozen] RemoveEmployerDto dto)
        {
            //Arrange
            employerService.GetConfirmDeleteEmployerOpportunityAsync(Arg.Any <int>(), Arg.Any <string>()).Returns(dto);

            //Act
            var result = await sut.ConfirmDeleteAsync(opportunity.Id) as ViewResult;

            //Assert
            result.Should().NotBeNull();
        }
예제 #8
0
        private CompareLogic ChangeOfRequestArrange(GetApprenticeshipResponse mediatorResponse)
        {
            _mockMediator.Setup(x => x.SendAsync(It.IsAny <GetApprenticeshipRequest>())).ReturnsAsync(mediatorResponse);

            _employerOrchestrator = new EmployerOrchestrator(_mockMediator.Object, Mock.Of <ICommitmentsLogger>(), new FacetMapper(Mock.Of <ICurrentDateTime>()), new ApprenticeshipFilterService(new FacetMapper(Mock.Of <ICurrentDateTime>())),
                                                             new ApprenticeshipMapper(), _commitmentMapper.Object, Mock.Of <ITransferRequestMapper>(), Mock.Of <IHashingService>());

            _controller = new EmployerController(_employerOrchestrator, _apprenticeshipsOrchestrator);

            CompareLogic comparer = new CompareLogic();

            comparer.Config.IgnoreObjectTypes = true;

            return(comparer);
        }
        public void Setup()
        {
            _mockMediator     = new Mock <IMediator>();
            _commitmentMapper = new Mock <ICommitmentMapper>();
            _commitmentMapper.Setup(x => x.MapFrom(It.IsAny <Domain.Entities.Commitment>(), It.IsAny <CallerType>()))
            .Returns(new CommitmentView());

            _employerOrchestrator    = new EmployerOrchestrator(_mockMediator.Object, Mock.Of <ICommitmentsLogger>(), new FacetMapper(Mock.Of <ICurrentDateTime>()), new ApprenticeshipFilterService(new FacetMapper(Mock.Of <ICurrentDateTime>())), Mock.Of <IApprenticeshipMapper>(), _commitmentMapper.Object);
            _apprenticeshipOrchestor = new ApprenticeshipsOrchestrator(
                _mockMediator.Object,
                Mock.Of <IDataLockMapper>(),
                Mock.Of <IApprenticeshipMapper>(),
                Mock.Of <ICommitmentsLogger>());

            _controller = new EmployerController(_employerOrchestrator, _apprenticeshipOrchestor);
        }
예제 #10
0
        public void EmployerController_edit_get_returns_employer()
        {
            //Arrange
            serv = new Mock <IEmployerService>();
            var fakeemployer = new Domain.Employer();

            serv.Setup(p => p.Get(Testid)).Returns(fakeemployer);
            woServ = new Mock <IWorkOrderService>();
            ctrlr  = new EmployerController(serv.Object, def.Object, map);
            //Act
            var result = ctrlr.Edit(Testid) as PartialViewResult;

            //Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result.ViewData.Model, typeof(Web.ViewModel.Employer));
        }
예제 #11
0
        public async Task Then_Result_Should_Return_To_Start(
            [Frozen] IEmployerService employerService,
            EmployerController sut,
            int opportunityId)
        {
            //Arrange
            employerService.GetSavedEmployerOpportunitiesAsync(Arg.Any <string>()).Returns(new SavedEmployerOpportunityViewModel());

            //Act
            var result = await sut.DeleteEmployerAsync(opportunityId) as RedirectToRouteResult;

            //Assert
            result.Should().NotBeNull();
            result?.RouteName.Should().Be("Start");
            result?.RouteName.Should().NotBe("GetSavedEmployerOpportunity");
        }
예제 #12
0
        public void create_post_invalid_throws_exception()
        {
            //Arrange
            var employer = new Domain.Employer();

            form.Remove("name");

            serv = new Mock <IEmployerService>();
            serv.Setup(p => p.Create(employer, "UnitTest")).Returns(employer);
            woServ = new Mock <IWorkOrderService>();
            ctrlr  = new EmployerController(serv.Object, def.Object, map);
            ctrlr.SetFakeControllerContext();
            ctrlr.ValueProvider = form.ToValueProvider();
            JsonResult result = ctrlr.Create(employer, "UnitTest");

            Assert.IsNotNull(result);
        }
예제 #13
0
        public void delete_post_returns_json()
        {
            //Arrange
            serv = new Mock <IEmployerService>();
            var fakeform = new FormCollection();

            woServ = new Mock <IWorkOrderService>();
            ctrlr  = new EmployerController(serv.Object, def.Object, map);
            ctrlr.SetFakeControllerContext();
            ctrlr.ValueProvider = fakeform.ToValueProvider();
            //Act
            var result = ctrlr.Delete(Testid, "UnitTest");

            //Assert
            Assert.AreEqual("{ status = OK, jobSuccess = True, deletedID = 4242 }",
                            result.Data.ToString());
        }
예제 #14
0
        public async Task employer_create_post_invalid_throws_exception()
        {
            //Arrange
            var employer = new Employer {
                ID = testId, name = string.Empty
            };

            _serv.Setup(p => p.Create(employer, "UnitTest")).Returns(employer);
            _controller = new EmployerController(_serv.Object, _defaults.Object, map, _adaptor.Object);
            _controller.ModelState.AddModelError("name", "Required");

            //Act
            var result = await _controller.Create(employer, "UnitTest");

            //Assert
            Assert.IsNotNull(result);
        }
예제 #15
0
        public async Task EmployerController_edit_get_returns_employer()
        {
            //Arrange
            _serv = new Mock <IEmployerService>();
            _serv.Setup(p => p.Get(testId)).Returns(new Employer());

            var mapperConfig = new MapperConfiguration(config => { config.ConfigureMvc(); });
            var mapper       = mapperConfig.CreateMapper();

            _controller = new EmployerController(_serv.Object, _defaults.Object, mapper, _adaptor.Object);
            //Act
            var result = await _controller.Edit(testId) as PartialViewResult;

            //Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result.ViewData.Model, typeof(Machete.Web.ViewModel.Employer));
        }
예제 #16
0
 private async void button1_Click(object sender, EventArgs e)
 {
     if (radioButton1.Checked)
     {
         type = Type.JobSeeker;
         if (await LoginValidation.Validate(type, username_box.Text, password_box.Text))
         {
             JobSeekerController jscontr = new JobSeekerController();
             _myId = jscontr.GetIdByUsername(username_box.Text);
             Hide();
             JobSeekerMenu JSMenu = new JobSeekerMenu(_myId);
             JSMenu.ShowDialog(this);
             username_box.Text = "";
             password_box.Text = "";
             Show();
         }
         else
         {
             MessageBox.Show("Username or Password is incorrect");
         }
     }
     else if (radioButton2.Checked)
     {
         type = Type.Employer;
         if (await LoginValidation.Validate(type, username_box.Text, password_box.Text))
         {
             EmployerController empcontr = new EmployerController();
             _myId = empcontr.GetIdByUsername(username_box.Text);
             Hide();
             EmployerMenu EMenu = new EmployerMenu(_myId);
             EMenu.ShowDialog(this);
             username_box.Text = "";
             password_box.Text = "";
             Show();
         }
         else
         {
             MessageBox.Show("Username or Password is incorrect");
         }
     }
     else
     {
         MessageBox.Show("Please choose a type of login");
     }
 }
        public When_Employer_SaveOpportunityCompanyName_Is_Submitted_With_Invalid_CompanyName_And_Valid_EmployerCrmId()
        {
            var config = new MapperConfiguration(c => c.AddMaps(typeof(EmployerMapper).Assembly));
            var mapper = new Mapper(config);

            var opportunityService = Substitute.For <IOpportunityService>();
            var employerService    = Substitute.For <IEmployerService>();
            var referralService    = Substitute.For <IReferralService>();

            employerService.ValidateCompanyNameAndCrmIdAsync(new Guid("11111111-1111-1111-1111-111111111111"), "").Returns(false);

            var employerController = new EmployerController(employerService, opportunityService, referralService, mapper);

            _employerController = new ClaimsBuilder <EmployerController>(employerController)
                                  .Add(ClaimTypes.Role, RolesExtensions.StandardUser)
                                  .AddUserName("Username")
                                  .Build();
        }
예제 #18
0
        public When_Employer_Details_Submitted_Invalid_Phone_Min_Digits()
        {
            var employerService    = Substitute.For <IEmployerService>();
            var opportunityService = Substitute.For <IOpportunityService>();
            var referralService    = Substitute.For <IReferralService>();

            var viewModel = new EmployerDetailsViewModel
            {
                Phone = "1"
            };

            var config = new MapperConfiguration(c => c.AddMaps(typeof(EmployerMapper).Assembly));
            var mapper = new Mapper(config);

            _employerController = new EmployerController(employerService, opportunityService, referralService, mapper);

            _result = _employerController.SaveOpportunityEmployerDetailsAsync(viewModel).GetAwaiter().GetResult();
        }
        public When_Employer_SaveOpportunityCompanyName_Is_Submitted_Successfully()
        {
            _viewModel.OpportunityId = OpportunityId;
            _viewModel.OpportunityItemId = OpportunityItemId;
            _viewModel.CompanyName = CompanyName;
            _viewModel.SelectedEmployerCrmId = new Guid("33333333-3333-3333-3333-333333333333");

            _employerService = Substitute.For<IEmployerService>();
            _employerService.ValidateCompanyNameAndCrmIdAsync(_employerCrmId, CompanyName).Returns(true);
            _employerService.GetEmployerOpportunityOwnerAsync(Arg.Any<Guid>())
                .Returns((string)null);

            _opportunityService = Substitute.For<IOpportunityService>();
            var referralService = Substitute.For<IReferralService>();

            var httpContextAccessor = Substitute.For<IHttpContextAccessor>();

            var config = new MapperConfiguration(c =>
            {
                c.AddMaps(typeof(EmployerDtoMapper).Assembly);
                c.ConstructServicesUsing(type =>
                    type.Name.Contains("LoggedInUserEmailResolver") ?
                        new LoggedInUserEmailResolver<FindEmployerViewModel, CompanyNameDto>(httpContextAccessor) :
                            type.Name.Contains("LoggedInUserNameResolver") ?
                                (object)new LoggedInUserNameResolver<FindEmployerViewModel, CompanyNameDto>(httpContextAccessor) :
                                    type.Name.Contains("UtcNowResolver") ?
                                        new UtcNowResolver<FindEmployerViewModel, CompanyNameDto>(new DateTimeProvider()) :
                                            null);
            });

            var mapper = new Mapper(config);

            var employerController = new EmployerController(_employerService, _opportunityService, referralService, mapper);
            var controllerWithClaims = new ClaimsBuilder<EmployerController>(employerController)
                .AddUserName(ModifiedBy)
                .Build();

            httpContextAccessor.HttpContext.Returns(controllerWithClaims.HttpContext);

            _result = controllerWithClaims.SaveOpportunityCompanyNameAsync(_viewModel).GetAwaiter().GetResult();
        }
예제 #20
0
        private void RatedEmployees_Load(object sender, EventArgs e)
        {
            JobController jobController = new JobController();
            var           jobs          = jobController.GetJobs().Where(x => x.Employer_Id == _myId).ToList();

            ProfileController profileController = new ProfileController();

            EmployerController empController = new EmployerController();
            var rates = empController.Select(_myId).EmployerRates;

            var result = from job in jobs
                         join rate in rates on new { cont1 = job.Employer_Id, cont2 = job.Id } equals new { cont1 = rate.Employer_Id, cont2 = rate.Job_Id }
            select new RatedEmployeesData
            {
                Position       = job.Position,
                YourRate       = new RatedEmployeesData().GetImage(rate.Rate),
                JobSeekersRate = new RatedEmployeesData().SetCompanysRate(job.Id, rate.JobSeeker_Id),
                JobSeekersName = profileController.Select(rate.JobSeeker_Id).FirstName
            };

            dataGridView1.DataSource = result.ToList();
        }
        public When_Employer_GetOpportunityCompanyName_Is_Loaded()
        {
            _employerService = Substitute.For <IEmployerService>();
            var opportunityService = Substitute.For <IOpportunityService>();
            var referralService    = Substitute.For <IReferralService>();

            _employerService.GetOpportunityEmployerAsync(OpportunityId, OpportunityItemId)
            .Returns(new FindEmployerViewModel
            {
                OpportunityId         = OpportunityId,
                OpportunityItemId     = OpportunityItemId,
                SelectedEmployerCrmId = _employerCrmId,
                CompanyName           = CompanyName
            });

            var config = new MapperConfiguration(c => c.AddMaps(typeof(EmployerDtoMapper).Assembly));
            var mapper = new Mapper(config);

            var employerController = new EmployerController(_employerService, opportunityService, referralService, mapper);

            _result = employerController.GetOpportunityCompanyNameAsync(OpportunityId, OpportunityItemId).GetAwaiter().GetResult();
        }
예제 #22
0
        public async Task EmployerController_WhenDataIsValid_MethodGetMustReturnAllEmployer()
        {
            // Arrange
            var employerController = new EmployerController(_logger.Object, _notificationMessages.Object);
            Mock <IGetEmployerUseCaseAsync> useCase = new Mock <IGetEmployerUseCaseAsync>();
            var response = GetListEmployer();

            useCase.Setup(x => x.RunAsync()).ReturnsAsync(response);
            var result = await employerController.GetAll(useCase.Object);

            // Act
            var objectResult   = result.Should().BeOfType <OkObjectResult>().Subject;
            var objectResponse = objectResult.Value.Should().BeAssignableTo <IEnumerable <EmployeeEntity> >().Subject;

            // Assert
            Assert.NotNull(objectResponse);
            Assert.Collection(objectResponse,
                              item => Assert.Equal("TI", item.Name),
                              item => Assert.Equal("Business", item.Name),
                              item => Assert.Equal("Management", item.Name),
                              item => Assert.Equal("Marketing", item.Name));
        }
        public When_Employer_Details_Is_Loaded()
        {
            var config          = new MapperConfiguration(c => c.AddMaps(typeof(EmployerDtoMapper).Assembly));
            var referralService = Substitute.For <IReferralService>();
            var mapper          = new Mapper(config);

            var employerService = Substitute.For <IEmployerService>();

            employerService.GetOpportunityEmployerDetailAsync(Arg.Any <int>(), Arg.Any <int>()).Returns(new EmployerDetailsViewModel
            {
                OpportunityId     = OpportunityId,
                OpportunityItemId = OpportunityItemId,
                CompanyName       = CompanyName,
                PrimaryContact    = EmployerContact,
                Phone             = EmployerContactPhone,
                Email             = EmployerContactEmail
            });

            var employerController = new EmployerController(employerService, Substitute.For <IOpportunityService>(), referralService, mapper);

            _result = employerController.GetEmployerDetailsAsync(OpportunityId, OpportunityItemId).GetAwaiter().GetResult();
        }
예제 #24
0
        private void no_btn_Click(object sender, EventArgs e)
        {
            if (_userType == Type.Employer)
            {
                EmployerRatesController rateController     = new EmployerRatesController();
                EmployerController      employerController = new EmployerController();
                Employer emp = employerController.Select(_myId);

                var jobs = _employerControl.Positions.Items;
                foreach (Job j in jobs)
                {
                    EmployerRates rate = new EmployerRates()
                    {
                        Employer_Id  = _myId,
                        JobSeeker_Id = _jobSeeker.Id,
                        Job_Id       = j.Id,
                        Rate         = false
                    };
                    rateController.Insert(rate);
                }
                ResetEmployerViewFields();
                EmployersView();
            }
            if (_userType == Type.JobSeeker)
            {
                JobSeekerRatesController rateController      = new JobSeekerRatesController();
                JobSeekerController      jobSeekerController = new JobSeekerController();
                JobSeeker      jobSeeker = jobSeekerController.Select(_myId);
                JobSeekerRates rate      = new JobSeekerRates()
                {
                    JobSeeker_Id = _myId,
                    Job_Id       = _job.Id,
                    Rate         = false
                };
                rateController.Insert(rate);
                ResetJobSeekerViewFields();
                JobSeekersView();
            }
        }
예제 #25
0
        public void SetUp()
        {
            _currentDateTime = new Mock <ICurrentDateTime>();
            _currentDateTime.Setup(x => x.Now).Returns(new DateTime(2018, 1, 1));

            _mockMediator = new Mock <IMediator>();
            _mockMediator.Setup(m => m.SendAsync(It.IsAny <GetApprenticeshipsRequest>()))
            .ReturnsAsync(new GetApprenticeshipsResponse
            {
                Apprenticeships = new List <Domain.Entities.Apprenticeship>()
            });

            _employerOrchestrator = new EmployerOrchestrator(_mockMediator.Object, Mock.Of <ICommitmentsLogger>(), new FacetMapper(_currentDateTime.Object), new ApprenticeshipFilterService(new FacetMapper(_currentDateTime.Object)), new ApprenticeshipMapper(), Mock.Of <ICommitmentMapper>());

            _apprenticeshipsOrchestrator = new ApprenticeshipsOrchestrator(
                _mockMediator.Object,
                Mock.Of <IDataLockMapper>(),
                Mock.Of <IApprenticeshipMapper>(),
                Mock.Of <ICommitmentsLogger>());

            _controller = new EmployerController(_employerOrchestrator, _apprenticeshipsOrchestrator);
        }
예제 #26
0
        public void TestInitialize()
        {
            Domain.WorkOrder.iPending = 123;
            serv      = new Mock <IEmployerService>();
            woServ    = new Mock <IWorkOrderService>();
            dbfactory = new Mock <IDatabaseFactory>();
            def       = new Mock <IDefaults>();
            map       = new MapperConfig().getMapper();


            ctrlr = new EmployerController(serv.Object, def.Object, map);
            ctrlr.SetFakeControllerContext();
            form = new FormCollection
            {
                { "ID", "12345" },
                { "name", "blah" },
                { "address1", "UnitTest" },
                { "city", "footown" },
                { "state", "WA" },
                { "phone", "123-456-7890" },
                { "zipcode", "1234567890" }
            };
        }
        public void SetUp()
        {
            _contractServiceMock     = new Mock <IContractService>();
            _notificationServiceMock = new Mock <INotificationService>();
            _mapperMock = new Mock <IMapper>();

            var user = new ClaimsPrincipal(new ClaimsIdentity(new[]
            {
                new Claim(ClaimTypes.NameIdentifier, "1"),
                new Claim(ClaimTypes.Name, "SiebeCorstjens")
            }));

            _controller = new EmployerController(_contractServiceMock.Object, _notificationServiceMock.Object,
                                                 _mapperMock.Object)
            {
                ControllerContext = new ControllerContext()
                {
                    HttpContext = new DefaultHttpContext()
                    {
                        User = user
                    }
                }
            };
        }
예제 #28
0
        private void RatedJobs_Load(object sender, EventArgs e)
        {
            EmployerController empController = new EmployerController();

            JobController jobController = new JobController();
            var           jobs          = jobController.GetJobs();

            JobSeekerController jobSeekerController = new JobSeekerController();
            var seekerRates = jobSeekerController.Select(_myId);



            var result = from job in jobs
                         join rate in seekerRates.JobSeekerRates on job.Id equals rate.Job_Id
                         select new RatedJobsData
            {
                JobPosition  = job.Position,
                CompanyName  = job.Name,
                YourRate     = new RatedJobsData().GetImage(rate.Rate),
                CompanysRate = new RatedJobsData().SetCompanysRate(job.Id, rate.JobSeeker_Id)
            };

            dataGridView1.DataSource = result.ToList();

            var companiesOffers = from job in jobs
                                  group job by job.Employer_Id into g
                                  select new
            {
                Name  = jobs.First(x => x.Employer_Id == g.Key).Name,
                Count = g.Count(),
            };
            var sum = companiesOffers.Select(x => x.Count).Aggregate((y, z) => y + z);

            label1.Text = string.Format("Number of job offers: {0}", sum);
            dataGridView2.DataSource = companiesOffers.ToList();
        }
        public void ActionIdShouldReturnCorrectViewModels()
        {
            var employerMockService = new Mock <IEmployerService>();

            employerMockService.Setup(
                x => x.GetById <EmployerDetailsViewModel>(1))
            .Returns(new EmployerDetailsViewModel()
            {
                Name = "TestName"
            });

            var controller = new EmployerController(employerMockService.Object);
            var result     = controller.Id(1, "test");

            Assert.IsType <ViewResult>(result);
            var viewResult = result as ViewResult;

            Assert.IsType <EmployerDetailsViewModel>(viewResult.Model);
            var viewModel = viewResult.Model as EmployerDetailsViewModel;

            Assert.Equal("TestName", viewModel.Name);

            employerMockService.Verify(x => x.GetById <EmployerDetailsViewModel>(1), Times.Once);
        }
        public When_Employer_Consent_Is_Submitted_Successfully()
        {
            var opportunityService = Substitute.For <IOpportunityService>();

            var httpContextAccessor = Substitute.For <IHttpContextAccessor>();

            var config = new MapperConfiguration(c => c.AddMaps(typeof(EmployerDtoMapper).Assembly));

            _referralService = Substitute.For <IReferralService>();
            var mapper = new Mapper(config);

            var employerController   = new EmployerController(null, opportunityService, _referralService, mapper);
            var controllerWithClaims = new ClaimsBuilder <EmployerController>(employerController)
                                       .AddStandardUser()
                                       .AddUserName("username")
                                       .Build();

            httpContextAccessor.HttpContext.Returns(controllerWithClaims.HttpContext);

            _result = controllerWithClaims.SaveEmployerConsentAsync(new EmployerConsentViewModel
            {
                OpportunityId = 1
            }).GetAwaiter().GetResult();
        }