public void testEncodeWithForcedCodeSetFailureCodeSetCWrongAmountOfDigits()
        {
            String toEncode = "123456789";
            // An uneven amount of digits should not be accepted when the code set is forced to C.

            var options = new Code128EncodingOptions();

            options.ForceCodeset = Code128EncodingOptions.Codesets.C;
            BitMatrix result = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0, options.Hints);
        }
        public void testEncodeWithForcedCodeSetFailureCodeSetCBadCharactersFncCode()
        {
            String toEncode = "123\u00f2a678";
            // Function codes other than 1 should not be accepted when the code set is forced to C.

            var options = new Code128EncodingOptions();

            options.ForceCodeset = Code128EncodingOptions.Codesets.C;
            BitMatrix result = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0, options.Hints);
        }
        public void testEncodeWithForcedCodeSetFailureCodeSetCBadCharactersNonNum()
        {
            String toEncode = "123a5678";
            // Non-digit characters should not be accepted when the code set is forced to C.

            var options = new Code128EncodingOptions();

            options.ForceCodeset = Code128EncodingOptions.Codesets.C;
            BitMatrix result = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0, options.Hints);
        }
        public void testEncodeWithForcedCodeSetFailureCodeSetBBadCharacter()
        {
            String toEncode = "ASdf\00123"; // \0 (ascii value 0)
                                            // Characters with ASCII value below 32 should not be accepted when the code set is forced to B.

            var options = new Code128EncodingOptions();

            options.ForceCodeset = Code128EncodingOptions.Codesets.B;
            BitMatrix result = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0, options.Hints);
        }
        public void testEncodeWithForcedCodeSetFailureCodeSetABadCharacter()
        {
            // Lower case characters should not be accepted when the code set is forced to A.
            String toEncode = "ASDFx0123";

            var options = new Code128EncodingOptions();

            options.ForceCodeset = Code128EncodingOptions.Codesets.A;
            BitMatrix result = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0, options.Hints);
        }
        public void testEncodeWithForcedCodeSetFailureCodeSetB()
        {
            String toEncode = "1234";
            //                          would default to C           "1"             "2"             "3"             "4"  check digit 88
            String expected = QUIET_SPACE + START_CODE_B + "10011100110" + "11001110010" + "11001011100" + "11001001110" + "11110010010" + STOP + QUIET_SPACE;

            var options = new Code128EncodingOptions();

            options.ForceCodeset = Code128EncodingOptions.Codesets.B;
            BitMatrix result = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0, options.Hints);

            String actual = BitMatrixTestCase.matrixToString(result);

            Assert.AreEqual(expected, actual);
        }