コード例 #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 DecodeTextB1B()
        {
            Bill bill = SampleQRCodeText.CreateBillData1();

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

            TestHelper.NormalizeDecodedBill(bill2);
            Assert.Equal(bill, bill2);
        }
コード例 #4
0
        private void DecodeTextB1A()
        {
            Bill bill = SampleQRCodeText.CreateBillData1();

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

            NormalizeDecodedBill(bill2);
            Assert.Equal(bill, bill2);
        }
コード例 #5
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);
        }
コード例 #6
0
        public void CreateText1()
        {
            Bill bill = SampleQRCodeText.CreateBillData1();

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