GS1Parser
GS1Parser copied to clipboard
AII Dict not accessible from "outside"
I made a Property to access the internally held AIIDict to the "outside world".
public static SortedDictionary<string, AII> AIIDictionary { get { return aiiDict; } }
This makes life easier in using the code in different classes and unit tests, e.g.
public void TestStandardGS1Code()
{
string code = $"0112345678901234211234567890123456789{(char)29}2401234567";
var result = GS1Parser.GS1.Parse(code);
Assert.IsTrue(result.Count == 3);
Assert.AreEqual("12345678901234", result[GS1Parser.GS1.AIIDictionary["01"]]);
Assert.AreEqual("69P17ZZ083500044300", result[GS1Parser.GS1.AIIDictionary["21"]]);
Assert.AreEqual("1234567", result[GS1Parser.GS1.AIIDictionary["240"]]);
}