Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Converters/ReferenceLineConverter.cs =================================================================== diff -u -r4670af35a2cb3c8b78d68a25804c3b620da19ddb -r3296448aeb47b8958143a00e05db76cd55627e97 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Converters/ReferenceLineConverter.cs (.../ReferenceLineConverter.cs) (revision 4670af35a2cb3c8b78d68a25804c3b620da19ddb) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Converters/ReferenceLineConverter.cs (.../ReferenceLineConverter.cs) (revision 3296448aeb47b8958143a00e05db76cd55627e97) @@ -7,10 +7,25 @@ namespace Application.Ringtoets.Storage.Converters { + /// + /// This class is able to convert a model to a + /// entity and back. + /// public class ReferenceLineConverter : IEntityConverter> { + /// + /// Creates a new from the . + /// + /// Collection of containing + /// the geometry of the . + /// A new instance with its geometry taken from the + /// . public ReferenceLine ConvertEntityToModel(ICollection entityCollection) { + if (entityCollection == null) + { + throw new ArgumentNullException("entityCollection"); + } var line = new ReferenceLine(); var geometry = entityCollection.Select(entity => new Point2D(decimal.ToDouble(entity.X), decimal.ToDouble(entity.Y))); @@ -19,21 +34,30 @@ return line; } - public ReferenceLine ConvertEntityToModel(ICollection entity, Func model) + /// + /// Updates the by adding the geometry from to it. + /// + /// The used as source. + /// The target collection. + public void ConvertModelToEntity(ReferenceLine modelObject, ICollection entityCollection) { - throw new NotImplementedException(); - } + if (modelObject == null) + { + throw new ArgumentNullException("modelObject"); + } + if (entityCollection == null) + { + throw new ArgumentNullException("entityCollection"); + } - public void ConvertModelToEntity(ReferenceLine modelObject, ICollection entity) - { - entity.Clear(); + entityCollection.Clear(); foreach (Point2D point in modelObject.Points) { - entity.Add(new ReferenceLinePointEntity + entityCollection.Add(new ReferenceLinePointEntity { X = Convert.ToDecimal(point.X), Y = Convert.ToDecimal(point.Y), - Order = entity.Count + Order = entityCollection.Count }); } }