Exemplo n.º 1
0
        public void Encode_NonAsciiCharacterInAsciiMode_ShouldThrowException()
        {
            Action action = () => Code93Encoder.Encode("ù", false, true);

            action.Should().Throw <InvalidOperationException>()
            .WithMessage("Only ASCII strings can be encoded");
        }
Exemplo n.º 2
0
        public void Encode_UnderscoreInNonAsciiMode_ShouldThrowException()
        {
            Action action = () => Code93Encoder.Encode("_", false, false);

            action.Should().Throw <InvalidOperationException>()
            .WithMessage("Invalid data");
        }
Exemplo n.º 3
0
        public void Encode_ContainsStarInNonAsciiMode_ShouldThrowException()
        {
            Action action = () => Code93Encoder.Encode("01*", false, false);

            action.Should().Throw <InvalidOperationException>()
            .WithMessage("Invalid data! Try full ASCII mode");
        }
Exemplo n.º 4
0
        public void Code93EncoderText_SetAndGetValue_ReturnsDefaultValue()
        {
            // Arrange, Act
            var code93Encoder = new Code93Encoder();

            // Assert
            code93Encoder.Text.ShouldBeNull();
        }
Exemplo n.º 5
0
        public void Code93EncoderText_SetAndGetValue_ReturnsTheSetValue()
        {
            // Arrange, Act
            var code93Encoder = new Code93Encoder
            {
                Text = DummyStringValue
            };

            // Assert
            code93Encoder.Text.ShouldBe(DummyStringValue);
        }
Exemplo n.º 6
0
        public void Encode(string data, string testResult)
        {
            IBarcode code = Code93Encoder.Encode(data, true, false);

            code.Bounds.X.Should().Be(testResult.Length);
            code.Bounds.Y.Should().Be(1);
            code.Metadata.CodeKind.Should().Be(BarcodeType.Code93);
            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);
        }
Exemplo n.º 7
0
 public void Code93EncodeBars(string input, string expected)
 {
     Assert.Equal(expected, Code93Encoder.EncodeBars(input));
 }
Exemplo n.º 8
0
 public void Code93CheckDigits(string input, string expected)
 {
     Assert.Equal(expected, Code93Encoder.CheckDigits(input));
 }
Exemplo n.º 9
0
        public void Encode_UnderscoreInAsciiMode_ShouldNotThrowException()
        {
            Action action = () => Code93Encoder.Encode("_", false, true);

            action.Should().NotThrow();
        }