public void TestBicycleRestrictions() { Itinero.Osm.Vehicles.Vehicle.RegisterVehicles(); var vehicles = new Itinero.Osm.Vehicles.Vehicle[] { Itinero.Osm.Vehicles.Vehicle.Bicycle }; var tags = new AttributeCollection(); var profileTags = new AttributeCollection(); var metaTags = new AttributeCollection(); tags.AddOrReplace(new Attribute("highway", "residential")); tags.AddOrReplace(new Attribute("bicycle", "yes")); Assert.IsTrue(tags.Normalize(profileTags, metaTags, vehicles)); Assert.IsTrue(profileTags.Contains("highway", "residential")); Assert.IsFalse(profileTags.Contains("bicycle", "yes")); profileTags.Clear(); tags.Clear(); tags.AddOrReplace(new Attribute("highway", "residential")); tags.AddOrReplace(new Attribute("bicycle", "no")); Assert.IsTrue(tags.Normalize(profileTags, metaTags, vehicles)); Assert.IsTrue(profileTags.Contains("highway", "residential")); Assert.IsTrue(profileTags.Contains("bicycle", "no")); profileTags.Clear(); tags.Clear(); tags.AddOrReplace(new Attribute("highway", "residential")); tags.AddOrReplace(new Attribute("bicycle", "mistake")); Assert.IsTrue(tags.Normalize(profileTags, metaTags, vehicles)); Assert.IsTrue(profileTags.Contains("highway", "residential")); Assert.IsFalse(profileTags.Contains("bicycle", "mistake")); profileTags.Clear(); tags.Clear(); tags.AddOrReplace(new Attribute("highway", "footway")); tags.AddOrReplace(new Attribute("bicycle", "no")); Assert.IsTrue(tags.Normalize(profileTags, metaTags, vehicles)); Assert.IsTrue(profileTags.Contains("highway", "footway")); Assert.IsFalse(profileTags.Contains("bicycle", "no")); profileTags.Clear(); tags.Clear(); vehicles = new Itinero.Osm.Vehicles.Vehicle[] { Itinero.Osm.Vehicles.Vehicle.Car }; tags.AddOrReplace("highway", "residential"); tags.AddOrReplace("bicycle", "no"); Assert.IsTrue(tags.Normalize(profileTags, metaTags, vehicles)); Assert.IsTrue(profileTags.Contains("highway", "residential")); Assert.IsFalse(profileTags.Contains("bicycle", "no")); profileTags.Clear(); tags.Clear(); }
public void TestMotorwayAccess() { Itinero.Osm.Vehicles.Vehicle.RegisterVehicles(); var vehicles = new Itinero.Osm.Vehicles.Vehicle[] { Itinero.Osm.Vehicles.Vehicle.Pedestrian, Itinero.Osm.Vehicles.Vehicle.Bicycle, Itinero.Osm.Vehicles.Vehicle.Car }; var tags = new AttributeCollection(); var profileTags = new AttributeCollection(); var metaTags = new AttributeCollection(); tags.AddOrReplace("highway", "motorway"); tags.AddOrReplace("access", "no"); Assert.IsTrue(tags.Normalize(profileTags, metaTags, vehicles)); Assert.AreEqual(2, profileTags.Count); Assert.IsTrue(profileTags.Contains("highway", "motorway")); Assert.IsTrue(profileTags.Contains("motorcar", "no")); profileTags.Clear(); tags.Clear(); tags.AddOrReplace("highway", "motorway"); tags.AddOrReplace("access", "yes"); Assert.IsTrue(tags.Normalize(profileTags, metaTags, vehicles)); Assert.AreEqual(3, profileTags.Count); Assert.IsTrue(profileTags.Contains("highway", "motorway")); Assert.IsTrue(profileTags.Contains("bicycle", "yes")); Assert.IsTrue(profileTags.Contains("foot", "yes")); profileTags.Clear(); tags.Clear(); tags.AddOrReplace("highway", "motorway"); tags.AddOrReplace("access", "no"); tags.AddOrReplace("vehicle", "yes"); Assert.IsTrue(tags.Normalize(profileTags, metaTags, vehicles)); Assert.AreEqual(2, profileTags.Count); Assert.IsTrue(profileTags.Contains("highway", "motorway")); Assert.IsTrue(profileTags.Contains("bicycle", "yes")); profileTags.Clear(); tags.Clear(); }