Esempio n. 1
0
        public IActionResult DownloadDelegates()
        {
            var content = delegateDownloadFileService.GetDelegateDownloadFileForCentre(User.GetCentreId());

            return(File(
                       content,
                       FileHelper.ExcelContentType,
                       $"DLS Delegates for Bulk Update {DateTime.Today:yyyy-MM-dd}.xlsx"
                       ));
        }
Esempio n. 2
0
        public void GetDelegateDownloadFileForCentre_returns_expected_excel_data()
        {
            // Given
            using var expectedWorkbook = new XLWorkbook(
                      TestContext.CurrentContext.TestDirectory + DelegateUploadFileServiceTests.TestDelegateUploadRelativeFilePath
                      );

            A.CallTo(() => jobGroupsDataService.GetJobGroupsAlphabetical()).Returns(
                JobGroupsTestHelper.GetDefaultJobGroupsAlphabetical()
                );

            A.CallTo(() => userDataService.GetDelegateUserCardsByCentreId(2)).Returns(delegateUserCards);

            // When
            var resultBytes = delegateDownloadFileService.GetDelegateDownloadFileForCentre(2);

            using var resultsStream  = new MemoryStream(resultBytes);
            using var resultWorkbook = new XLWorkbook(resultsStream);

            // Then
            SpreadsheetTestHelper.AssertSpreadsheetsAreEquivalent(expectedWorkbook, resultWorkbook);
        }