public void CreateReferenceLineFeatures_GivenReferenceLine_ReturnsReferenceLineFeature() { // Setup const string id = "1"; const string name = "Traject 1"; var points = new[] { new Point2D(1.2, 2.3), new Point2D(2.7, 2.0) }; var referenceLine = new ReferenceLine(); referenceLine.SetGeometry(points); // Call IEnumerable <MapFeature> features = RiskeerMapDataFeaturesFactory.CreateReferenceLineFeatures(referenceLine, id, name); // Assert MapFeature mapFeature = features.Single(); Assert.AreEqual(3, mapFeature.MetaData.Keys.Count); Assert.AreEqual(id, mapFeature.MetaData["ID"]); Assert.AreEqual(name, mapFeature.MetaData["Naam"]); var expectedLength = new RoundedDouble(2, Math2D.Length(points)); Assert.AreEqual(expectedLength, (RoundedDouble)mapFeature.MetaData["Lengte*"], expectedLength.GetAccuracy()); AssertEqualPointCollections(points, mapFeature.MapGeometries.ElementAt(0)); }
public void CreateReferenceLineFeatures_ReferenceLineWithEmptyGeometry_ReturnsEmptyFeaturesCollection() { // Call IEnumerable <MapFeature> features = RiskeerMapDataFeaturesFactory.CreateReferenceLineFeatures(new ReferenceLine(), string.Empty, string.Empty); // Assert CollectionAssert.IsEmpty(features); }
public void CreateReferenceLineFeatures_ReferenceLineNull_ThrowsArgumentNullException() { // Call void Call() => RiskeerMapDataFeaturesFactory.CreateReferenceLineFeatures(null, string.Empty, string.Empty); // Assert var exception = Assert.Throws <ArgumentNullException>(Call); Assert.AreEqual("referenceLine", exception.ParamName); }
private void SetReferenceLineMapData() { ReferenceLine referenceLine = AssessmentSection.ReferenceLine; referenceLineMapData.Features = RiskeerMapDataFeaturesFactory.CreateReferenceLineFeatures(referenceLine, AssessmentSection.Id, AssessmentSection.Name); }