Beispiel #1
0
        public void Encode(bool includeChecksum, bool fullAsciiMode, string data, string testResult)
        {
            IBarcodeIntCS code = Code39.Encode(data, includeChecksum, fullAsciiMode);

            code.Bounds.X.Should().Be(testResult.Length);
            code.Bounds.Y.Should().Be(1);
            code.Metadata.CodeKind.Should().Be(BarcodeType.Code39);
            code.Metadata.Dimensions.Should().Be(1);

            string encoded = string.Empty;
            int    i       = 0;

            foreach (var r in testResult)
            {
                encoded += code.At(i++, 0) ? "1" : "0";
            }
            encoded.Should().Be(testResult);
        }
Beispiel #2
0
                    "1100011101011")] // STOP
        public void Encode(string txt, string testResult)
        {
            IBarcodeIntCS code = Code128Encoder.Encode(txt);

            code.Bounds.X.Should().Be(testResult.Length);
            code.Bounds.Y.Should().Be(1);
            code.Metadata.CodeKind.Should().Be(BarcodeType.Code128);
            code.Metadata.Dimensions.Should().Be(1);

            string encoded = string.Empty;
            int    i       = 0;

            foreach (var r in testResult)
            {
                encoded += code.At(i++, 0) ? "1" : "0";
            }
            encoded.Should().Be(testResult);
        }
        public void Encode(bool interleaved, bool includeChecksum, string txt, string testResult)
        {
            IBarcodeIntCS code = TwoToFiveEncoder.Encode(txt, interleaved, includeChecksum);

            code.Bounds.X.Should().Be(testResult.Length);
            code.Bounds.Y.Should().Be(1);
            code.Metadata.CodeKind.Should().Be(interleaved ? BarcodeType.TwoOfFiveInterleaved : BarcodeType.TwoOfFive);
            code.Metadata.Dimensions.Should().Be(1);

            string encoded = string.Empty;
            int    i       = 0;

            foreach (var r in testResult)
            {
                encoded += code.At(i++, 0) ? "1" : "0";
            }
            encoded.Should().Be(testResult);
        }
Beispiel #4
0
        public void Encode(string testCode, string testResult, string kind, bool checkContent)
        {
            IBarcodeIntCS code = Ean.Encode(testCode);

            if (checkContent)
            {
                code.Content.Should().Be(testCode);
            }

            code.Bounds.X.Should().Be(testResult.Length);
            code.Bounds.Y.Should().Be(1);
            code.Metadata.CodeKind.Should().Be(kind);
            code.Metadata.Dimensions.Should().Be(1);

            string encoded = string.Empty;
            int    i       = 0;

            foreach (var r in testResult)
            {
                encoded += code.At(i++, 0) ? "1" : "0";
            }
            encoded.Should().Be(testResult);
        }