Esempio n. 1
0
 private Task GenerateAndCompareBill(Bill bill, OutputSize outputSize, GraphicsFormat graphicsFormat)
 {
     bill.Format.OutputSize     = outputSize;
     bill.Format.GraphicsFormat = graphicsFormat;
     byte[] imageData = QRBill.Generate(bill);
     return(VerifyImages.Verify(imageData, graphicsFormat));
 }
Esempio n. 2
0
 private Task GenerateAndCompareBill(Bill bill)
 {
     bill.Format.OutputSize     = OutputSize.A4PortraitSheet;
     bill.Format.GraphicsFormat = GraphicsFormat.SVG;
     byte[] imageData = QRBill.Generate(bill);
     return(VerifyImages.VerifySvg(imageData));
 }
Esempio n. 3
0
 private Task GenerateAndCompareBill(Bill bill, GraphicsFormat graphicsFormat, SeparatorType separatorType)
 {
     bill.Format.GraphicsFormat = graphicsFormat;
     bill.Format.SeparatorType  = separatorType;
     byte[] imageData = QRBill.Generate(bill);
     return(VerifyImages.Verify(imageData, graphicsFormat));
 }
Esempio n. 4
0
        public Task LocaleIndependence()
        {
            CultureInfo savedCurrentCulture   = CultureInfo.CurrentCulture;
            CultureInfo savedCurrentUiCulture = CultureInfo.CurrentUICulture;

            CultureInfo culture = CultureInfo.CreateSpecificCulture("de-DE");

            Bill bill = SampleData.CreateExample4();

            using PDFCanvas canvas =
                      new PDFCanvas(QRBill.A4PortraitWidth, QRBill.A4PortraitHeight);
            try
            {
                CultureInfo.CurrentCulture   = culture;
                CultureInfo.CurrentUICulture = culture;

                QRBill.Draw(bill, canvas);
                return(VerifyImages.VerifyPdf(canvas.ToByteArray()));
            }
            finally
            {
                CultureInfo.CurrentCulture   = savedCurrentCulture;
                CultureInfo.CurrentUICulture = savedCurrentUiCulture;
            }
        }
Esempio n. 5
0
        public Task CreateQrBillFrench()
        {
            Bill bill = SampleData.CreateExample1();

            bill.Format.GraphicsFormat = GraphicsFormat.SVG;
            bill.Format.Language       = Language.FR;
            byte[] svg = QRBill.Generate(bill);
            return(VerifyImages.VerifySvg(svg));
        }
Esempio n. 6
0
        public Task CreateQrBill5()
        {
            Bill bill = SampleData.CreateExample3();

            bill.Format.OutputSize     = OutputSize.QrBillExtraSpace;
            bill.Format.GraphicsFormat = GraphicsFormat.SVG;
            byte[] svg = QRBill.Generate(bill);
            return(VerifyImages.VerifySvg(svg));
        }
Esempio n. 7
0
        public Task QrCodeAsSvg4()
        {
            Bill bill = SampleData.CreateExample4();

            bill.Format.OutputSize     = OutputSize.QrCodeOnly;
            bill.Format.GraphicsFormat = GraphicsFormat.SVG;
            byte[] svg = QRBill.Generate(bill);
            return(VerifyImages.VerifySvg(svg));
        }
Esempio n. 8
0
        public Task SvgWithChallengingCharacters()
        {
            Bill bill = SampleData.CreateExample1();

            bill.UnstructuredMessage   = "<h1>&&\"ff\"'t'";
            bill.Format.OutputSize     = OutputSize.QrBillOnly;
            bill.Format.GraphicsFormat = GraphicsFormat.SVG;
            byte[] svg = QRBill.Generate(bill);
            return(VerifyImages.VerifySvg(svg));
        }
        public Task AddVerticalSeparator()
        {
            var bill = SampleData.CreateExample1();

            bill.Format.SeparatorType = SeparatorType.None;
            using PDFCanvas canvas    =
                      new PDFCanvas(QRBill.A4PortraitWidth, QRBill.A4PortraitHeight);
            QRBill.Draw(bill, canvas);

            QRBill.DrawSeparators(SeparatorType.DashedLineWithScissors, false, canvas);

            MemoryStream ms = new MemoryStream();

            canvas.WriteTo(ms);

            return(VerifyImages.VerifyPdf(ms.ToArray()));
        }
Esempio n. 10
0
        public Task CurrentCulture(string locale)
        {
            CultureInfo savedCurrentCulture   = CultureInfo.CurrentCulture;
            CultureInfo savedCurrentUiCulture = CultureInfo.CurrentUICulture;

            CultureInfo culture = CultureInfo.CreateSpecificCulture(locale);

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

                Bill bill = SampleData.CreateExample3();
                bill.Format.OutputSize     = OutputSize.QrBillOnly;
                bill.Format.GraphicsFormat = GraphicsFormat.SVG;
                byte[] svg = QRBill.Generate(bill);
                return(VerifyImages.VerifySvg(svg).UseParameters(locale));
            }
            finally
            {
                CultureInfo.CurrentCulture   = savedCurrentCulture;
                CultureInfo.CurrentUICulture = savedCurrentUiCulture;
            }
        }