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(); }