public When_Recording_Referrals_And_Emails_Sent_Is_Loaded() { var config = new MapperConfiguration(c => c.AddMaps(typeof(SentViewModelMapper).Assembly)); var mapper = new Mapper(config); var dto = new ValidOpportunityDtoBuilder().Build(); _employerCrmId = dto.EmployerCrmId; _opportunityService = Substitute.For <IOpportunityService>(); _opportunityService.GetOpportunityAsync(1).Returns(dto); var opportunityController = new OpportunityController(_opportunityService, mapper); var controllerWithClaims = new ClaimsBuilder <OpportunityController>(opportunityController) .AddUserName("CreatedBy") .Build(); _result = controllerWithClaims.GetReferralEmailSentAsync(1).GetAwaiter().GetResult(); }