public When_OpportunityService_Is_Called_To_Get_Confirm_Delete_Opportunity() { var config = new MapperConfiguration(c => c.AddMaps(typeof(OpportunityMapper).Assembly)); var mapper = new Mapper(config); var opportunityRepository = Substitute.For <IOpportunityRepository>(); _opportunityItemRepository = Substitute.For <IRepository <OpportunityItem> >(); var provisionGapRepository = Substitute.For <IRepository <ProvisionGap> >(); var referralRepository = Substitute.For <IRepository <Domain.Models.Referral> >(); var googleMapApiClient = Substitute.For <IGoogleMapApiClient>(); var opportunityPipelineReportWriter = Substitute.For <IFileWriter <OpportunityReportDto> >(); var dateTimeProvider = Substitute.For <IDateTimeProvider>(); var dto = new ValidConfirmDeleteOpportunityItemViewModelBuilder().Build(); _opportunityItemRepository.GetSingleOrDefaultAsync( Arg.Any <Expression <Func <OpportunityItem, bool> > >(), Arg.Any <Expression <Func <OpportunityItem, ConfirmDeleteOpportunityItemViewModel> > >()) .Returns(dto); var opportunityService = new OpportunityService(mapper, opportunityRepository, _opportunityItemRepository, provisionGapRepository, referralRepository, googleMapApiClient, opportunityPipelineReportWriter, dateTimeProvider); _result = opportunityService.GetConfirmDeleteOpportunityItemAsync(1).GetAwaiter().GetResult(); }