-
-
Notifications
You must be signed in to change notification settings - Fork 129
Expand file tree
/
Copy pathBarcodeTest.cs
More file actions
107 lines (89 loc) · 3.59 KB
/
BarcodeTest.cs
File metadata and controls
107 lines (89 loc) · 3.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
using BinaryKits.Zpl.Label.Elements;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
using System.Diagnostics;
namespace BinaryKits.Zpl.Label.UnitTest
{
[TestClass]
public class BarcodeTest
{
[TestMethod]
public void Barcode39()
{
var elements = new List<ZplElementBase>
{
new ZplBarcode39("123ABC", 100, 100)
};
var renderEngine = new ZplEngine(elements);
var output = renderEngine.ToZplString(new ZplRenderOptions { AddEmptyLineBeforeElementStart = true });
Debug.WriteLine(output);
Assert.IsNotNull(output);
Assert.AreEqual("^XA\n^LH0,0\n\n^FO100,100\n^BY2,3\n^B3N,N,100,Y,N\n^FD123ABC^FS\n^XZ", output);
}
[TestMethod]
public void Barcode93()
{
var elements = new List<ZplElementBase>
{
new ZplBarcode93("123ABC", 100, 300)
};
var renderEngine = new ZplEngine(elements);
var output = renderEngine.ToZplString(new ZplRenderOptions { AddEmptyLineBeforeElementStart = true });
Debug.WriteLine(output);
Assert.IsNotNull(output);
Assert.AreEqual("^XA\n^LH0,0\n\n^FO100,300\n^BY2,3\n^BAN,100,Y,N,N\n^FD123ABC^FS\n^XZ", output);
}
[TestMethod]
public void Barcode128()
{
var elements = new List<ZplElementBase>
{
new ZplBarcode128("123ABC", 100, 300)
};
var renderEngine = new ZplEngine(elements);
var output = renderEngine.ToZplString(new ZplRenderOptions { AddEmptyLineBeforeElementStart = true });
Debug.WriteLine(output);
Assert.IsNotNull(output);
Assert.AreEqual("^XA\n^LH0,0\n\n^FO100,300\n^BY2,3\n^BCN,100,Y,N\n^FD123ABC^FS\n^XZ", output);
}
[TestMethod]
public void BarcodeEan13()
{
var elements = new List<ZplElementBase>
{
new ZplBarcodeEan13("123456", 100, 300)
};
var renderEngine = new ZplEngine(elements);
var output = renderEngine.ToZplString(new ZplRenderOptions { AddEmptyLineBeforeElementStart = true });
Debug.WriteLine(output);
Assert.IsNotNull(output);
Assert.AreEqual("^XA\n^LH0,0\n\n^FO100,300\n^BY2,3\n^BEN,100,Y,N\n^FD123456^FS\n^XZ", output);
}
[TestMethod]
public void DataMatrixDefault()
{
var elements = new List<ZplElementBase>
{
new ZplDataMatrix("123ABC", 100, 300)
};
var renderEngine = new ZplEngine(elements);
var output = renderEngine.ToZplString(new ZplRenderOptions { AddEmptyLineBeforeElementStart = true });
Debug.WriteLine(output);
Assert.IsNotNull(output);
Assert.AreEqual("^XA\n^LH0,0\n\n^FO100,300\n^BXN,100,0\n^FD123ABC^FS\n^XZ", output);
}
[TestMethod]
public void DataMatrix200()
{
var elements = new List<ZplElementBase>
{
new ZplDataMatrix("123ABC", 100, 300, qualityLevel: QualityLevel.ECC200)
};
var renderEngine = new ZplEngine(elements);
var output = renderEngine.ToZplString(new ZplRenderOptions { AddEmptyLineBeforeElementStart = true });
Debug.WriteLine(output);
Assert.IsNotNull(output);
Assert.AreEqual("^XA\n^LH0,0\n\n^FO100,300\n^BXN,100,200\n^FD123ABC^FS\n^XZ", output);
}
}
}