public static void Main(string[] args) { var options = GetOptions(args); if(!options.RequiredOptionIsMissing) { try { using (var destFs = new FileStream(options.DestinationsFile, FileMode.Open)) { using(var taxFs = new FileStream(options.TaxonomyFile, FileMode.Open)) { var destinationParser = new DestinationParser(destFs); var templateLoader = new TemplateLoader(); var taxonomyParser = new TaxonomyParser(taxFs); var htmlFileWriter = new HTMLFileWriter(templateLoader, taxonomyParser); WriteFiles(destinationParser, htmlFileWriter, options); Console.WriteLine("HTML Generation finished. Wrote files to {0}", options.OutputFolder); } } } catch (Exception e) { Console.WriteLine("ERROR: {0}", e.Message); } } Console.WriteLine("Press any key to exit..."); Console.Read(); }
public void Find_the_parent_for_a_destination() { using (var stream = new FileStream("Resources/sample_taxonomy.xml", FileMode.Open)) { const string capeTownID = "355612"; const string southAfricaId = "355611"; const string southAfrica = "South Africa"; var taxonomyParser = new TaxonomyParser(stream); var parent = taxonomyParser.GetParent(capeTownID); Assert.That(parent, Has.Property("AtlasId").EqualTo(southAfricaId)); Assert.That(parent, Has.Property("Title").EqualTo(southAfrica)); } }
public void Find_the_direct_children_of_a_destination() { using (var stream = new FileStream("Resources/sample_taxonomy.xml", FileMode.Open)) { const string sudanId = "355629"; const string easternSudanId = "355630"; const string easternSudan = "Eastern Sudan"; const string khartoumId = "355632"; const string khartoum = "Khartoum"; var taxonomyParser = new TaxonomyParser(stream); var childIDs = taxonomyParser.GetChildren(sudanId); Assert.That(childIDs, Has.Count.EqualTo(2)); Assert.That(childIDs, Has.Exactly(1).With.Property("AtlasId").EqualTo(easternSudanId).And.Property("Title").EqualTo(easternSudan)); Assert.That(childIDs, Has.Exactly(1).With.Property("AtlasId").EqualTo(khartoumId).And.Property("Title").EqualTo(khartoum)); } }