public void TestIbaflinParsing() { const string pathToPdf = @"TestFiles\TestSPCParser\WC500064198.pdf"; var ts = SPCParser.GetTargetSpeciesFromMultiProductPdf(pathToPdf); Assert.IsTrue(ts.Keys.Count == 6, $"6 product names should be returned: {ts.Keys.Count}"); Assert.IsTrue(ts.All(k => k.Value != null && k.Value.Length > 0), "Empty target species array returned"); Assert.IsFalse(ts.Values.SelectMany(v => v).Any(string.IsNullOrWhiteSpace), "Blank target species returned"); Assert.IsTrue(ts.Where(kv => kv.Key.Contains("and")).All(kv => kv.Value.Length > 1), "multi-species product has single species"); }
public void TestGetTargetSpeciesFromMultiPDF() { const string pathtopdf = @"TestFiles\TestSPCParser\WC500065777.pdf"; var sp = SPCParser.GetTargetSpeciesFromMultiProductPdf(pathtopdf); Assert.IsNotNull(sp, "null dictionary returned"); Assert.IsFalse(sp.Count == 0, "empty dictionary returned"); Assert.IsTrue(sp.ContainsKey("Metacam 20 mg/ml solution for injection for cattle, pigs and horses"), "product not found"); Assert.IsTrue( sp["Metacam 20 mg/ml solution for injection for cattle, pigs and horses"] .Intersect(new[] { "cattle", "pigs", "horses" }).Count() == 3, $"Unexpected species list returned:{string.Join(',', sp["Metacam 20 mg/ml solution for injection for cattle, pigs and horses"])}"); }