public When_OpportunityService_Is_Called_To_Delete_Referral() { var config = new MapperConfiguration(c => c.AddMaps(typeof(OpportunityMapper).Assembly)); var mapper = new Mapper(config); var opportunityRepository = Substitute.For <IOpportunityRepository>(); var opportunityItemRepository = Substitute.For <IRepository <OpportunityItem> >(); var provisionGapRepository = Substitute.For <IRepository <ProvisionGap> >(); _referralRepository = Substitute.For <IRepository <Domain.Models.Referral> >(); _referralRepository.GetFirstOrDefaultAsync(Arg.Any <Expression <Func <Domain.Models.Referral, bool> > >()) .Returns(new Domain.Models.Referral { Id = ReferralId, OpportunityItemId = OpportunityItemId }); var googleMapApiClient = Substitute.For <IGoogleMapApiClient>(); var opportunityPipelineReportWriter = Substitute.For <IFileWriter <OpportunityReportDto> >(); var dateTimeProvider = Substitute.For <IDateTimeProvider>(); var opportunityService = new OpportunityService(mapper, opportunityRepository, opportunityItemRepository, provisionGapRepository, _referralRepository, googleMapApiClient, opportunityPipelineReportWriter, dateTimeProvider); opportunityService.DeleteReferralAsync(ReferralId).GetAwaiter().GetResult(); }