public async Task ReportController_GenerateAsync_CallsServicesAsync() { var reportGenerationService = new Mock <IReportGenerationService>(); var mongoReportRepository = new Mock <IMongoReportRepository>(); var domoService = new Mock <IDomoService>(); reportGenerationService.Setup(m => m.GenerateAsync(It.IsAny <Report>(), It.IsAny <GenerationSettings>())) .ReturnsAsync("http://www.example.org"); mongoReportRepository.Setup(m => m.GetAsync(It.IsAny <string>())) .ReturnsAsync((string slug) => new Report() { TemplateName = "invoice.docx", DataSet = "invoice_data", Slug = slug }); var controller = new ReportController(mongoReportRepository.Object, reportGenerationService.Object, domoService.Object); var result = await controller.GenerateAsync("voya-invoices", new GenerationSettings() { MasterGroup = "master-group" }); mongoReportRepository.Verify(m => m.GetAsync(It.Is <string>(s => s == "voya-invoices"))); reportGenerationService.Verify(m => m.GenerateAsync(It.Is <Report>(r => r.Slug == "voya-invoices" && r.TemplateName == "invoice.docx" && r.DataSet == "invoice_data"), It.Is <GenerationSettings>(s => s.MasterGroup == "master-group"))); }