示例#1
0
        [TestCase("123456789", "Code128TestBarcodeCodeC.png")] // Numbers-only "123456789"; // length % 2 == 1
        public void GenerateBitmap(string toEncode, string testFile)
        {
            // Assert
            using IBarcode barcode = new BC.Code128();
            var settings = GetCode128Settings();

            // Act
            using var bmp = barcode.Encode(toEncode, settings);
            bmp.Save(testFile, ImageFormat.Png);

            //Assert
            FileAssert.Exists(testFile);
        }
示例#2
0
        public void GenerateHighResBitmap(string toEncode, string testFile)
        {
            // Assert
            using IBarcode barcode = new BC.Code128();
            var settings = GetCode128Settings();

            settings.VerticalDPI = settings.HorizontalDPI = 300f;

            // Act
            using var bmp = barcode.Encode(toEncode, settings);
            bmp.Save(testFile, ImageFormat.Png);

            //Assert
            FileAssert.Exists(testFile);
        }