Пример #1
0
        public void DecodeMissingEpd()
        {
            string invalidText            = SampleQRCodeText.CreateQrCodeText1(false).Replace("EPD", "E_P");
            QRBillValidationException err = Assert.Throws <QRBillValidationException>(
                () => QRBill.DecodeQrCodeText(invalidText));

            TestHelper.AssertSingleError(err.Result, ValidationConstants.KeyValidDataStructure, ValidationConstants.FieldTrailer);
        }
Пример #2
0
        public void DecodeInvalidNumber()
        {
            string invalidText            = SampleQRCodeText.CreateQrCodeText1(false).Replace("3949.75", "1239d49.75");
            QRBillValidationException err = Assert.Throws <QRBillValidationException>(
                () => QRBill.DecodeQrCodeText(invalidText));

            TestHelper.AssertSingleError(err.Result, ValidationConstants.KeyValidNumber, ValidationConstants.FieldAmount);
        }
Пример #3
0
        public void CreateTextEmptyReference()
        {
            Bill             bill   = SampleQRCodeText.CreateBillData3();
            ValidationResult result = QRBill.Validate(bill);

            Assert.False(result.HasErrors);
            bill           = result.CleanedBill;
            bill.Reference = "";
            Assert.Equal(SampleQRCodeText.CreateQrCodeText3(false), QRBill.EncodeQrCodeText(bill));
        }
Пример #4
0
        public void DecodeTextB2()
        {
            Bill bill = SampleQRCodeText.CreateBillData2();

            TestHelper.NormalizeSourceBill(bill);
            Bill bill2 = QRBill.DecodeQrCodeText(SampleQRCodeText.CreateQrCodeText2(false));

            TestHelper.NormalizeDecodedBill(bill2);
            Assert.Equal(bill, bill2);
        }
Пример #5
0
        private void DecodeTextB1B()
        {
            Bill bill = SampleQRCodeText.CreateBillData1();

            TestHelper.NormalizeSourceBill(bill);
            Bill bill2 = QRBill.DecodeQrCodeText(SampleQRCodeText.CreateQrCodeText1(true));

            TestHelper.NormalizeDecodedBill(bill2);
            Assert.Equal(bill, bill2);
        }
        private void DecodeTextB1A()
        {
            Bill bill = SampleQRCodeText.CreateBillData1();

            NormalizeSourceBill(bill);
            Bill bill2 = QRBill.DecodeQrCodeText(SampleQRCodeText.CreateQrCodeText1(false));

            NormalizeDecodedBill(bill2);
            Assert.Equal(bill, bill2);
        }
Пример #7
0
        public void decodeIgnoreMinorVersion()
        {
            Bill bill = SampleQRCodeText.CreateBillData1();

            TestHelper.NormalizeSourceBill(bill);
            string qrCodeText = SampleQRCodeText.CreateQrCodeText1(false);

            qrCodeText = qrCodeText.Replace("\n0200\n", "\n0201\n");
            Bill bill2 = QRBill.DecodeQrCodeText(qrCodeText);

            TestHelper.NormalizeDecodedBill(bill2);
            Assert.Equal(bill, bill2);
        }
Пример #8
0
        public void CreateText5()
        {
            Bill bill = SampleQRCodeText.CreateBillData5();

            Assert.Equal(SampleQRCodeText.CreateQrCodeText5(false), QRBill.EncodeQrCodeText(bill));
        }
        private void CreateText4()
        {
            Bill bill = SampleQRCodeText.CreateBillData4();

            Assert.Equal(SampleQRCodeText.CreateQrCodeText4(false), QRBill.EncodeQrCodeText(bill));
        }