public void TestTargetSpeciesExtraction() { const string pathtospc = @"TestFiles\TestSPCParser\SPC_91079.docx"; var expectedoutput = new[] { "horses", "ponies", "donkies", "foals over four weeks of age" }; var ts = SPCParser.GetTargetSpecies(pathtospc); var intersectioncount = ts.Intersect(expectedoutput).Count(); Assert.IsTrue(intersectioncount == expectedoutput.Length, $"Intersection count:{intersectioncount}, expected {expectedoutput.Length}"); }
public void TestTargetSpeciesExtractionFromDocOldFormat() { const string pathtospc = @"TestFiles\TestSPCParser\SPC_124816.doc"; var expectedoutput = new[] { "cats" }; var pathtodocx = WordConverter.ConvertDocToDocx(pathtospc); var ts = SPCParser.GetTargetSpecies(pathtodocx); var intersectioncount = ts.Intersect(expectedoutput).Count(); Assert.IsTrue(intersectioncount == expectedoutput.Length, $"Intersection count:{intersectioncount}, expected {expectedoutput.Length}"); }
public void TestTargetSpeciesExtractionLocal() { var pid = VMDPIDFactory.GetVmdPid().Result; foreach (var ep in pid.ExpiredProducts.Where(ep => !EPARTools.IsEPAR(ep.SPC_Link))) { var spc = VMDPIDFactory.GetSpc(ep).Result; Debug.WriteLine(spc); spc = spc.ToLowerInvariant().EndsWith(".doc") ? WordConverter.ConvertDocToDocx(spc) : spc; var ts = SPCParser.GetTargetSpecies(spc); Assert.IsNotNull(ts, $"null ts for {ep.Name}, {spc}"); Assert.IsTrue(ts.Any(), $"empty ts for {ep.Name}, {spc}"); Assert.IsFalse(ts.Any(string.IsNullOrWhiteSpace), $"blank species for {ep.Name}, {spc}"); } }