public void SIE_Get_ExportOptions_VoucherSelection()
        {
            ISIEConnector connector     = new SIEConnector();
            var           exportOptions = new SIEExportOptions()
            {
                Selection = new List <VoucherSelection>()
                {
                    new VoucherSelection()
                    {
                        VoucherSeries     = "A",
                        FromVoucherNumber = 20,
                        ToVoucherNumber   = 24
                    },
                    new VoucherSelection()
                    {
                        VoucherSeries     = "B",
                        FromVoucherNumber = 5,
                        ToVoucherNumber   = 9
                    }
                }
            };

            var data        = connector.Get(SIEType.Transactions, exportOptions: exportOptions);
            var sieDocument = Parse(data);

            Assert.AreEqual(5 + 5, sieDocument.VER.Count);

            Assert.AreEqual(5, sieDocument.VER.Count(v => v.Series == "A"));
            Assert.AreEqual(false, sieDocument.VER.Any(v => v.Series == "A" && int.Parse(v.Number) < 20));
            Assert.AreEqual(false, sieDocument.VER.Any(v => v.Series == "A" && int.Parse(v.Number) > 24));

            Assert.AreEqual(5, sieDocument.VER.Count(v => v.Series == "B"));
            Assert.AreEqual(false, sieDocument.VER.Any(v => v.Series == "B" && int.Parse(v.Number) < 5));
            Assert.AreEqual(false, sieDocument.VER.Any(v => v.Series == "B" && int.Parse(v.Number) > 9));
        }
        public void SIE_Get_ExportOptions_ExcludeUnused()
        {
            ISIEConnector connector        = new SIEConnector();
            var           exportOptionsAll = new SIEExportOptions()
            {
                ExportAll = true
            };
            var exportOptionsExcludeUnused = new SIEExportOptions()
            {
                ExportAll = false
            };

            var data            = connector.Get(SIEType.PeriodBalance, exportOptions: exportOptionsAll);
            var sieDocumentFull = Parse(data);

            data = connector.Get(SIEType.Transactions, exportOptions: exportOptionsExcludeUnused);
            var sieDocumentFiltered = Parse(data);

            Assert.AreEqual(true, sieDocumentFull.KONTO.Count > sieDocumentFiltered.KONTO.Count);
        }
        public void SIE_Get()
        {
            var           types     = Enum.GetValues(typeof(SIEType)).Cast <SIEType>().ToList();
            ISIEConnector connector = new SIEConnector();

            foreach (var sieType in types)
            {
                var data = connector.Get(sieType);
                MyAssert.HasNoError(connector);
                Assert.IsNotNull(data);
            }
        }
Esempio n. 4
0
        public void SIE_Get()
        {
            var           types     = Enum.GetValues(typeof(SIEType)).Cast <SIEType>().ToList();
            ISIEConnector connector = new SIEConnector();

            foreach (var sieType in types)
            {
                var data = connector.Get(sieType);
                Assert.IsNotNull(data);

                var content  = Decode(data);
                var typeLine = content.Split("\n").First(l => l.StartsWith("#SIETYP")).Trim();
                Assert.AreEqual($"#SIETYP {sieType.GetStringValue()}", typeLine);
            }
        }
        public void SIE_Get_ExportOptions_Period()
        {
            ISIEConnector connector     = new SIEConnector();
            var           exportOptions = new SIEExportOptions()
            {
                FromDate = new DateTime(2020, 4, 1),
                ToDate   = new DateTime(2020, 8, 31)
            };

            var data        = connector.Get(SIEType.Transactions, exportOptions: exportOptions);
            var sieDocument = Parse(data);

            Assert.AreEqual(false, sieDocument.VER.Any(v => v.VoucherDate < exportOptions.FromDate));
            Assert.AreEqual(false, sieDocument.VER.Any(v => v.VoucherDate > exportOptions.ToDate));

            Assert.AreEqual(true, sieDocument.VER.Any(v => v.VoucherDate > exportOptions.FromDate));
        }
Esempio n. 6
0
        public void SIE_Get_SpecificYear()
        {
            var finYears = new FinancialYearConnector().Find(null).Entities;

            ISIEConnector connector = new SIEConnector();

            foreach (var finYear in finYears)
            {
                var data = connector.Get(SIEType.Transactions, finYear.Id);
                Assert.IsNotNull(data);

                var content          = Decode(data);
                var yearLine         = content.Split("\n").First(l => l.StartsWith("#RAR")).Trim();
                var expectedYearLine =
                    $"#RAR 0 {finYear.FromDate?.ToString("yyyyMMdd")} {finYear.ToDate?.ToString("yyyyMMdd")}";
                Assert.AreEqual(expectedYearLine, yearLine);
            }
        }
        public void SIE_Get_ExportOptions_VoucherSelection_IncompleteInterval()
        {
            ISIEConnector connector     = new SIEConnector();
            var           exportOptions = new SIEExportOptions()
            {
                Selection = new List <VoucherSelection>()
                {
                    new VoucherSelection()
                    {
                        VoucherSeries     = "A",
                        FromVoucherNumber = 20,
                        //ToVoucherNumber = 24
                    },
                    new VoucherSelection()
                    {
                        VoucherSeries     = "B",
                        FromVoucherNumber = 5,
                        ToVoucherNumber   = 9
                    }
                }
            };

            connector.Get(SIEType.Transactions, exportOptions: exportOptions);
        }