public When_Opportunity_Controller_Download_Opportunity_Spreadsheet_Is_Called() { var config = new MapperConfiguration(c => c.AddMaps(typeof(OpportunityMapper).Assembly)); var mapper = new Mapper(config); _opportunityService = Substitute.For <IOpportunityService>(); _opportunityService.GetOpportunitySpreadsheetDataAsync(1).Returns( new FileDownloadDto { FileName = "test_file.xlsx", ContentType = "application/file", FileContent = new byte[] { 01, 02 } }); var opportunityController = new OpportunityController(_opportunityService, mapper); _result = opportunityController.DownloadOpportunitySpreadsheetAsync(1).GetAwaiter().GetResult(); }