public void Test(bool metric) { // prepare the temp directory MapMaker mapMaker = new MapMaker(); mapMaker.PrepareTempDirectory(); if (false == metric) { mapMaker.MapMakerSettings.ContoursRenderingRulesSource = "Rules/ContoursRulesFeet.txt"; } ContoursDataSource dataSource = new ContoursDataSource(@"..\..\..\..\Data\Samples\IBF\Maribor.ibf"); IPolishMapFileCreator creator = new DefaultPolishMapFileCreator(mapMaker.MapMakerSettings); List <ProductFile> productFiles = new List <ProductFile>(); ITaskRunner runner = MockRepository.GenerateStub <ITaskRunner> (); runner.Expect(r => r.RegisterProductFile(null)).IgnoreArguments() .Do((Action <ProductFile>)(productFiles.Add)).Repeat.Any(); dataSource.AnalyzeData(mapMaker.MapMakerSettings); dataSource.GeneratePolishMapFiles(runner, creator); int polylinesCount = 0; foreach (ProductFile file in productFiles) { string mapContent = File.ReadAllText(file.ProductFileName); polylinesCount += GetCountOf(mapContent, "[POLYLINE]"); if (metric) { Assert.IsTrue(mapContent.Contains("Label=800")); Assert.IsTrue(mapContent.Contains("Label=820")); Assert.IsFalse(mapContent.Contains("Label=790")); } else { Assert.IsTrue(mapContent.Contains("Label=450")); Assert.IsTrue(mapContent.Contains("Label=600")); Assert.IsFalse(mapContent.Contains("Label=1000")); } } if (metric) { Assert.AreEqual(9602, polylinesCount); } else { Assert.AreEqual(1968, polylinesCount); } }
public void MultipleMaps() { MapMakerSettings settings = new MapMakerSettings(); ITaskRunner taskRunner = MockRepository.GenerateStub <ITaskRunner>(); taskRunner.Expect(r => r.MapMakerSettings).Return(settings).Repeat.Any(); MapMakingCommand cmd = new MapMakingCommand(taskRunner, SerializersRegistry, FileSystem); cmd.Execute(new[] { "-osm:test1.osm", "-osm:test2.osm" }); Assert.AreEqual(2, settings.MapDataSources.Count); }