Esempio n. 1
0
        public void CorrectWorkbookGenertateNoteTest()
        {
            FileInfo fI = new FileInfo(_filePathCorrect);

            if (fI.Exists)
            {
                _ssr = new SpreadSheetReader(fI.FullName, true, false);
            }
            else
            {
                throw new FileLoadException("cannot load the input file");
            }

            _ssr.ReadDataFromFile();

            Assert.IsTrue(_ssr.ColumnMapping.ContainsKey(ImportColumnName.PaymentDate));
            Assert.IsTrue(_ssr.ColumnMapping.ContainsKey(ImportColumnName.NoteTitle));
            Assert.IsTrue(_ssr.ColumnMapping.ContainsKey(ImportColumnName.NoteID));
            Assert.IsTrue(_ssr.ColumnMapping.ContainsKey(ImportColumnName.NoteDate));
            Assert.IsTrue(_ssr.ColumnMapping.ContainsKey(ImportColumnName.NoteAmount));
            Assert.IsTrue(_ssr.ColumnMapping.ContainsKey(ImportColumnName.NIP));
            Assert.IsTrue(_ssr.ColumnMapping.ContainsKey(ImportColumnName.LP));
            Assert.IsTrue(_ssr.ColumnMapping.ContainsKey(ImportColumnName.AccountNumber));
            Assert.IsTrue(_ssr.ColumnMapping.Count == 8);
        }
Esempio n. 2
0
        private void ReadInputFile(string filePath, SearchSettings searchSettings, IProgress <string> progress)
        {
            DateTime startTime = DateTime.Now;

            progress.Report(string.Format("{0}: Rozpoczęto wczytywanie danych z pliku.\n", DateTime.Now.ToLongTimeString()));
            progress.Report(string.Format("{0}: Nazwa pliku: {1}.\n", DateTime.Now.ToLongTimeString(), searchSettings.InputFileName));
            progress.Report(string.Format("{0}: Pełna ścieżka pliku: {1}\\{2}.\n", DateTime.Now.ToLongTimeString(), searchSettings.InputFileDir, searchSettings.InputFileName));

            SpreadSheetReader ssReader = new SpreadSheetReader(filePath, searchSettings.GenerateNotes, searchSettings.VerifyAlsoForInvoiceDate);

            _companiesReadFromFile = ssReader.ReadDataFromFile();
        }
Esempio n. 3
0
        public void CorrectWorkbookGenertateNoteTest()
        {
            FileInfo fI = new FileInfo(_filePathCorrect);

            if (fI.Exists)
            {
                _ssr = new SpreadSheetReader(fI.FullName, true, false);
            }
            else
            {
                throw new FileLoadException("cannot load the input file");
            }

            var companies = _ssr.ReadDataFromFile();

            Assert.IsTrue(_ssr.ColumnMapping.ContainsKey(ImportColumnName.PaymentDate));
            Assert.IsTrue(_ssr.ColumnMapping.ContainsKey(ImportColumnName.NoteTitle));
            Assert.IsTrue(_ssr.ColumnMapping.ContainsKey(ImportColumnName.NoteID));
            Assert.IsTrue(_ssr.ColumnMapping.ContainsKey(ImportColumnName.NoteDate));
            Assert.IsTrue(_ssr.ColumnMapping.ContainsKey(ImportColumnName.NoteAmount));
            Assert.IsTrue(_ssr.ColumnMapping.ContainsKey(ImportColumnName.NIP));
            Assert.IsTrue(_ssr.ColumnMapping.ContainsKey(ImportColumnName.LP));
            Assert.IsTrue(_ssr.ColumnMapping.ContainsKey(ImportColumnName.AccountNumber));
            Assert.IsTrue(_ssr.ColumnMapping.Count == 8);

            Assert.IsTrue(companies.Count == 5);
            InputCompany comp = companies[0];

            Assert.AreEqual("46124017501111001068892448", comp.BankAccountNumber);
            Assert.AreEqual("5+1-7792369887", comp.ID);
            Assert.AreEqual("1", comp.LP);
            Assert.AreEqual(5, comp.RowNumber);
            Assert.AreEqual("7792369887", comp.NIP);
            Assert.AreEqual("12.01.2019r.", comp.NoteDate);
            Assert.AreEqual("12", comp.NoteID);
            Assert.AreEqual("1000", comp.NoteNettoAmount);
            Assert.AreEqual("Q1", comp.NoteTitle);
            Assert.AreEqual("15.02.2019r.", comp.PaymentDate);
            Assert.AreEqual(5, comp.RowNumber);
        }
Esempio n. 4
0
 public void ReadWorkbookWithNoCorrectSheetNameTest()
 {
     Assert.Throws <SpreadSheetReaderException>(() => _ssr.ReadDataFromFile());
 }
Esempio n. 5
0
        public void ReadWorkbookWithNoHeaderTest()
        {
            SpreadSheetReaderHeaderException e = Assert.Throws <SpreadSheetReaderHeaderException>(() => _ssr.ReadDataFromFile());

            Assert.IsTrue(e.Message.Contains("nag³ówka"));
        }