Beispiel #1
0
        public void Encode_AlphaNumericContent_ShouldThrowException()
        {
            // Arrange
            var numericEncoder = new NumericEncoder();

            // Act
            Action action = () => numericEncoder.Encode("foo", ErrorCorrectionLevel.H);

            // Assert
            action.Should().Throw <InvalidOperationException>()
            .WithMessage("foo can not be ancoded as Numeric");
        }
Beispiel #2
0
        public void Encode_NumericContentTooLong_ShouldThrowException()
        {
            // Arrange
            var numericEncoder = new NumericEncoder();

            // Act
            Action action = () => numericEncoder.Encode(new string('1', 14297), ErrorCorrectionLevel.H);

            // Assert
            action.Should().Throw <InvalidOperationException>()
            .WithMessage("Too much data to encode");
        }
Beispiel #3
0
        public void Encode(string content, byte[] expectedBytes)
        {
            // Arrange
            var numericEncoder = new NumericEncoder();

            // Act
            (BitList bits, VersionInfo versionInfo) = numericEncoder.Encode(content, ErrorCorrectionLevel.H);

            // Assert
            bits.Should().NotBeNull();
            versionInfo.Should().NotBeNull();
            bits.GetBytes().Should().BeEquivalentTo(expectedBytes);
        }