ilopez / GS1Parser

A GS1 Parser for C#
MIT License
28 stars 11 forks source link

AII Dict not accessible from "outside" #2

Open tbird2017 opened 7 years ago

tbird2017 commented 7 years ago

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"]]);
        }