public void OSMRouteConstructorSetsSpeedPropertyFromMaxSpeedTag() { OSMWay source = new OSMWay(11); source.Tags.Add(new OSMTag("maxspeed", "50")); RoadType sourceType = new RoadType(); OSMRoad target = new OSMRoad(source, sourceType); Assert.Equal(50, target.Speed); }
public void OSMRouteConstructorCopiesDataFromWay() { OSMWay source = new OSMWay(11); source.Nodes.Add(1); source.Nodes.Add(2); source.Tags.Add(new OSMTag("highway", "track")); RoadType sourceType = new RoadType(); sourceType.RequiredTags.Add(new OSMTag("highway", "track")); OSMRoad target = new OSMRoad(source, sourceType); Assert.Equal(source.Nodes.Count, target.Nodes.Count); Assert.Equal(source.Tags.First(), target.Tags.First()); Assert.Equal(sourceType, target.RoadType); }
public void OSMRouteConstructorSetsSpeedPropertyFromRoadTypeSpeed() { OSMWay source = new OSMWay(11); RoadType sourceType = new RoadType(); sourceType.Speed = 60; OSMRoad target = new OSMRoad(source, sourceType); Assert.Equal(60, target.Speed); }
public void OSMRouteConstructorSetsId() { OSMRoad target = new OSMRoad(11); Assert.Equal(11, target.ID); }
public void RoadTypeIsAccessibleReverseAppliesOnewayTagOverridesDefaultValueForRoadType2() { RoadType roadType = new RoadType(); roadType.Oneway = false; OSMWay way = new OSMWay(0); way.Tags.Add(new OSMTag("oneway", "yes")); OSMRoad target = new OSMRoad(way, roadType); Assert.Equal(true, target.IsAccessible()); Assert.Equal(false, target.IsAccessibleReverse()); }
public void RoadTypeIsAccessibleReverseAppliesDefaultOnewayValueFromRoadType() { RoadType roadType = new RoadType(); roadType.Oneway = true; OSMWay oneWay = new OSMWay(0); OSMRoad target = new OSMRoad(oneWay, roadType); Assert.Equal(true, target.IsAccessible()); Assert.Equal(false, target.IsAccessibleReverse()); }
public void RoadTypeIsAccessibleAndIsAccessibleReturnsCorrectValuesForReverseOnewayRoads() { RoadType roadType = new RoadType(); roadType.RequiredTags.Add(new OSMTag("highway", "*")); OSMWay oneWay1 = new OSMWay(0); oneWay1.Tags.Add(new OSMTag("oneway", "-1")); OSMRoad target1 = new OSMRoad(oneWay1, roadType); OSMWay oneWay2 = new OSMWay(0); oneWay2.Tags.Add(new OSMTag("oneway", "reverse")); OSMRoad target2 = new OSMRoad(oneWay2, roadType); Assert.False(target1.IsAccessible()); Assert.True(target1.IsAccessibleReverse()); Assert.False(target2.IsAccessible()); Assert.True(target2.IsAccessibleReverse()); }
public void OSMRouteConstructorSetsSpeedPropertyMaxspeedTagTakesPrecedenceOverRoadTypeSpeed() { OSMWay source = new OSMWay(11); source.Tags.Add(new OSMTag("maxspeed", "50")); RoadType sourceType = new RoadType(); sourceType.Speed = 60; OSMRoad target = new OSMRoad(source, sourceType); Assert.Equal(50, target.Speed); }
public void OSMRouteConstructorSetsSpeedPropertyIgnoresInvalidMaxspeedTags() { OSMWay source = new OSMWay(11); source.Tags.Add(new OSMTag("maxspeed", "some value")); RoadType sourceType = new RoadType(); sourceType.Speed = 60; OSMRoad target = new OSMRoad(source, sourceType); Assert.Equal(60, target.Speed); }