public void TestHashCode()
        {
            SwicoBillInformation info1 = CreateBillInformation();
            SwicoBillInformation info2 = CreateBillInformation();

            Assert.Equal(info1.GetHashCode(), info2.GetHashCode());
        }
        public void EncodeExample4()
        {
            SwicoBillInformation billInfo = SwicoExamples.CreateExample3();
            string text = billInfo.EncodeAsText();

            Assert.Equal(SwicoExamples.Example3Text, text);
        }
        public void SetCustomerReference()
        {
            SwicoBillInformation billInformation = new SwicoBillInformation
            {
                CustomerReference = "1234-ABC"
            };

            Assert.Equal("1234-ABC", billInformation.CustomerReference);
        }
        public void SetVatNumber()
        {
            SwicoBillInformation billInformation = new SwicoBillInformation
            {
                VatNumber = "109030864"
            };

            Assert.Equal("109030864", billInformation.VatNumber);
        }
        public void SetVatStartDate()
        {
            SwicoBillInformation billInformation = new SwicoBillInformation
            {
                VatStartDate = new DateTime(2019, 3, 1)
            };

            Assert.Equal(new DateTime(2019, 3, 1), billInformation.VatStartDate);
        }
        public void SetVatRate()
        {
            SwicoBillInformation billInformation = new SwicoBillInformation
            {
                VatRate = 7.7m
            };

            Assert.Equal(7.7m, billInformation.VatRate);
        }
        public void SetVatEndDate()
        {
            SwicoBillInformation billInformation = new SwicoBillInformation
            {
                VatEndDate = new DateTime(2020, 2, 29)
            };

            Assert.Equal(new DateTime(2020, 2, 29), billInformation.VatEndDate);
        }
        public void SetInvoiceDate()
        {
            SwicoBillInformation billInformation = new SwicoBillInformation
            {
                InvoiceDate = new DateTime(2020, 6, 30)
            };

            Assert.Equal(new DateTime(2020, 6, 30), billInformation.InvoiceDate);
        }
        public void SetInvoiceNumber()
        {
            SwicoBillInformation billInformation = new SwicoBillInformation
            {
                InvoiceNumber = "ABC"
            };

            Assert.Equal("ABC", billInformation.InvoiceNumber);
        }
        public void TestEquals()
        {
            SwicoBillInformation info1 = CreateBillInformation();
            SwicoBillInformation info2 = CreateBillInformation();

            Assert.Equal(info1, info2);
            Assert.Equal(info2, info1);

            info2.CustomerReference = "ABC";
            Assert.NotEqual(info1, info2);
        }
        public void TestEqualsTrivial()
        {
            SwicoBillInformation info = new SwicoBillInformation();

            Assert.Equal(info, info);

            SwicoBillInformation nullBill = null;

            Assert.NotEqual(nullBill, info);
            Assert.NotEqual((object)"xxx", info);
        }
        public void InvalidTag_IsIgnored(string rawBillInformation)
        {
            SwicoBillInformation billInformation = SwicoBillInformation.DecodeText(rawBillInformation);

            Assert.Equal(new SwicoBillInformation()
            {
                InvoiceNumber = "X.66711"
            },
                         billInformation
                         );
        }
        public void EscapedCharacters_Unescaped(string rawBillInformation, string customerReference)
        {
            SwicoBillInformation billInformation = SwicoBillInformation.DecodeText(rawBillInformation);

            Assert.Equal(new SwicoBillInformation()
            {
                InvoiceNumber     = "X.66711",
                CustomerReference = customerReference,
                PaymentConditions = new List <(decimal, int)> {
                    (0m, 30)
                }
            },
        public void InvalidTagOrder_IsIgnored(string rawBillInformation)
        {
            SwicoBillInformation billInformation = SwicoBillInformation.DecodeText(rawBillInformation);

            Assert.Equal(new SwicoBillInformation()
            {
                InvoiceNumber = "X.66711",
                InvoiceDate   = new DateTime(2019, 5, 20),
                VatNumber     = "123456789"
            },
                         billInformation
                         );
        }
        public void RetrieveSwicoBillInfo()
        {
            Bill bill = CreateBill();

            bill.BillInformation = "//S1/10/ABC-293234/20/234.2343-094/32/8";
            SwicoBillInformation billInfo = bill.RetrieveSwicoBillInformation();

            Assert.Equal(new SwicoBillInformation
            {
                InvoiceNumber     = "ABC-293234",
                CustomerReference = "234.2343-094",
                VatRate           = 8m
            },
                         billInfo);
        }
        public void DifferentLocales_HaveNoEffect(string locale)
        {
            CultureInfo savedCurrentCulture   = CultureInfo.CurrentCulture;
            CultureInfo savedCurrentUiCulture = CultureInfo.CurrentUICulture;

            CultureInfo culture = CultureInfo.CreateSpecificCulture(locale);

            try
            {
                CultureInfo.CurrentCulture   = culture;
                CultureInfo.CurrentUICulture = culture;

                var billInformation = SwicoBillInformation.DecodeText(SwicoExamples.Example3Text);
                Assert.Equal(SwicoExamples.CreateExample3(), billInformation);
            }
            finally
            {
                CultureInfo.CurrentCulture   = savedCurrentCulture;
                CultureInfo.CurrentUICulture = savedCurrentUiCulture;
            }
        }
        public void DueDate_IsNull()
        {
            SwicoBillInformation billInformation = new SwicoBillInformation();

            Assert.Null(billInformation.DueDate);

            billInformation.InvoiceDate = new DateTime(2020, 6, 30);
            Assert.Null(billInformation.DueDate);

            billInformation.PaymentConditions = new List <(decimal, int)>();
            Assert.Null(billInformation.DueDate);

            billInformation.InvoiceDate = null;
            Assert.Null(billInformation.DueDate);

            billInformation.InvoiceDate = new DateTime(2020, 6, 30);
            Assert.Null(billInformation.DueDate);

            billInformation.PaymentConditions = new List <(decimal, int)> {
                (2m, 10)
            };
            Assert.Null(billInformation.DueDate);
        }
        public void EmptyValues_Decoded(string rawBillInformation)
        {
            var billInformation = SwicoBillInformation.DecodeText(rawBillInformation);

            Assert.Equal(new SwicoBillInformation(), billInformation);
        }
        public void Example6_FullyDecoded()
        {
            var billInformation = SwicoBillInformation.DecodeText(SwicoExamples.Example6Text);

            Assert.Equal(SwicoExamples.CreateExample6(), billInformation);
        }
 public void NullValue_ReturnsNull()
 {
     Assert.Null(SwicoBillInformation.DecodeText(null));
 }
        public void InvalidStart_ReturnsNull(string rawBillInformation)
        {
            SwicoBillInformation billInformation = SwicoBillInformation.DecodeText(rawBillInformation);

            Assert.Null(billInformation);
        }