public void Encode_NonAsciiCharacterInAsciiMode_ShouldThrowException() { Action action = () => Code93.Encode("รน", false, true); action.Should().Throw <InvalidOperationException>() .WithMessage("Only ASCII strings can be encoded"); }
public void Encode_ContainsStarInNonAsciiMode_ShouldThrowException() { Action action = () => Code93.Encode("01*", false, false); action.Should().Throw <InvalidOperationException>() .WithMessage("Invalid data! Try full ASCII mode"); }
public void Encode_UnderscoreInNonAsciiMode_ShouldThrowException() { Action action = () => Code93.Encode("_", false, false); action.Should().Throw <InvalidOperationException>() .WithMessage("Invalid data"); }
public void Encode(string data, string testResult) { IBarcode code = Code93.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); }
public void Encode_UnderscoreInAsciiMode_ShouldNotThrowException() { Action action = () => Code93.Encode("_", false, true); action.Should().NotThrow(); }