예제 #1
0
        public List <ExportFile> GetExportFiles(CommaFormatter fileFormatter, List <Facility> facilities, Client client)
        {
            var exportFiles            = new List <ExportFile>();
            var exportDate             = DateTime.Now;
            var accountsAboveThreshold = new List <Account>();

            foreach (var facility in facilities)
            {
                var accounts = accountService.GetAllAccountsByFacilityForClient(facility, client);

                foreach (var account in accounts)
                {
                    if (account.Balance > account.Client.BalanceThreshold)
                    {
                        accountsAboveThreshold.Add(account);
                    }
                }

                var exportFile = new ExportFile
                {
                    FileName = fileFormatter.FormatFileName(exportDate, facility),
                    Content  = fileFormatter.FormatContent(accountsAboveThreshold)
                };

                exportFiles.Add(exportFile);
            }

            return(exportFiles);
        }
예제 #2
0
        public void ICanExportCommaFormat1()
        {
            // Arrange
            var fileFormatter       = new CommaFormatter();
            var client              = accountService.GetAllAccounts().Where(a => a.Client.FormatterType == FormatterType.CSV).FirstOrDefault().Client;
            var facilities          = facilityService.GetAllFacilities();
            var expectedExportFiles = TestHelper.GenerateCommaExportFiles(facilityService, accountService, fileFormatter, client);

            // Act
            // var actualExportFiles = fileService.GetExportFiles(fileFormatter, facilities);
            var actualExportFiles = fileService.GetExportFile(client);

            // Assert
            CollectionAssert.AreEqual(expectedExportFiles, actualExportFiles);
        }
예제 #3
0
        public void CSVClientsProduceCSVFiles()
        {
            // Arrange
            var fileFormatter = new CommaFormatter();
            var client        = accountService.GetAllAccounts().Where(a => a.Client.FormatterType == FormatterType.CSV).FirstOrDefault().Client;
            var facilities    = facilityService.GetAllFacilities();

            var expectedExportFiles = TestHelper.GenerateCommaExportFiles(facilityService, accountService, fileFormatter, client);

            // Act
            // var actualExportFiles = fileService.GetExportFiles(fileFormatter, facilities);
            var actualExportFiles = fileService.GetExportFile(client);

            // Assert
            foreach (var file in actualExportFiles)
            {
                Assert.AreEqual("csv", file.FileName.Substring(file.FileName.Length - 3));
            }
        }
예제 #4
0
 public List <ExportFile> GetExportFiles(CommaFormatter fileFormatter, List <Facility> facilities, Client client)
 {
     return(new List <ExportFile>());
 }
예제 #5
0
 public ExportFile GetExportFile(CommaFormatter fileFormatter, List <Facility> facilities)
 {
     return(exportFile);
 }