Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/DataTypes/SerializableLine.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/DataTypes/SerializableLine.cs (revision 0)
+++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/DataTypes/SerializableLine.cs (revision 7a9324ff54b5ca989a0c5a535c3f45dec74417bb)
@@ -0,0 +1,61 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Xml.Serialization;
+using Core.Common.Base.Geometry;
+
+namespace Ringtoets.AssemblyTool.IO.Model.DataTypes
+{
+ ///
+ /// Class that describes a serializable GML line.
+ ///
+ public class SerializableLine
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ public SerializableLine() {}
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The geometry of the line.
+ /// Thrown when
+ /// is null.
+ public SerializableLine(IEnumerable geometry)
+ {
+ if (geometry == null)
+ {
+ throw new ArgumentNullException(nameof(geometry));
+ }
+
+ LineString = new SerializableLineString(geometry);
+ }
+
+ ///
+ /// Gets or sets the line string containing the geometry of the line.
+ ///
+ [XmlElement(AssemblyXmlIdentifiers.LineString, Namespace = AssemblyXmlIdentifiers.GmlNamespace)]
+ public SerializableLineString LineString { get; set; }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/DataTypes/SerializableLineString.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/DataTypes/SerializableLineString.cs (revision 0)
+++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/DataTypes/SerializableLineString.cs (revision 7a9324ff54b5ca989a0c5a535c3f45dec74417bb)
@@ -0,0 +1,73 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Xml.Serialization;
+using Core.Common.Base.Geometry;
+using Ringtoets.AssemblyTool.IO.Model.Helpers;
+using Ringtoets.AssemblyTool.IO.Properties;
+
+namespace Ringtoets.AssemblyTool.IO.Model.DataTypes
+{
+ ///
+ /// Class describing a serializable line string.
+ ///
+ public class SerializableLineString
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ public SerializableLineString()
+ {
+ CoordinateSystem = Resources.SrsName;
+ }
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The geometry of the line.
+ /// Thrown when
+ /// is null.
+ public SerializableLineString(IEnumerable geometry) : this()
+ {
+ if (geometry == null)
+ {
+ throw new ArgumentNullException(nameof(geometry));
+ }
+
+ Geometry = GeometrySerializationFormatter.Format(geometry);
+ }
+
+ ///
+ /// Gets or sets the name of the coordinate system this line is projected on.
+ ///
+ [XmlAttribute(AssemblyXmlIdentifiers.CoordinateSystem)]
+ public string CoordinateSystem { get; set; }
+
+ ///
+ /// Gets or sets the list of coordinates representing the
+ /// geometry of the line.
+ ///
+ [XmlElement(AssemblyXmlIdentifiers.Geometry)]
+ public string Geometry { get; set; }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/DataTypes/SerializableMeasure.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/DataTypes/SerializableMeasure.cs (revision 0)
+++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/DataTypes/SerializableMeasure.cs (revision 7a9324ff54b5ca989a0c5a535c3f45dec74417bb)
@@ -0,0 +1,67 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Xml.Serialization;
+
+namespace Ringtoets.AssemblyTool.IO.Model.DataTypes
+{
+ ///
+ /// Class describing a serializable measure.
+ ///
+ public class SerializableMeasure
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ public SerializableMeasure()
+ {
+ Value = double.NaN;
+ }
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The unit of measure.
+ /// The value of the measure.
+ public SerializableMeasure(string unitOfMeasure, double value)
+ {
+ if (unitOfMeasure == null)
+ {
+ throw new ArgumentNullException(nameof(unitOfMeasure));
+ }
+
+ UnitOfMeasure = unitOfMeasure;
+ Value = value;
+ }
+ ///
+ /// Gets or sets the unit of measure.
+ ///
+ [XmlAttribute(AssemblyXmlIdentifiers.UnitOfMeasure)]
+ public string UnitOfMeasure { get; set; }
+
+ ///
+ /// Gets or sets the value of the measure.
+ ///
+ [XmlText]
+ public double Value { get; set; }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableAssessmentSection.cs
===================================================================
diff -u -r7f2399453f788c27181ea2b857a6cad170e78179 -r7a9324ff54b5ca989a0c5a535c3f45dec74417bb
--- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableAssessmentSection.cs (.../SerializableAssessmentSection.cs) (revision 7f2399453f788c27181ea2b857a6cad170e78179)
+++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableAssessmentSection.cs (.../SerializableAssessmentSection.cs) (revision 7a9324ff54b5ca989a0c5a535c3f45dec74417bb)
@@ -23,6 +23,7 @@
using System.Collections.Generic;
using System.Xml.Serialization;
using Core.Common.Base.Geometry;
+using Ringtoets.AssemblyTool.IO.Model.DataTypes;
using Ringtoets.AssemblyTool.IO.Properties;
namespace Ringtoets.AssemblyTool.IO.Model
Fisheye: Tag 7a9324ff54b5ca989a0c5a535c3f45dec74417bb refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableLine.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 7a9324ff54b5ca989a0c5a535c3f45dec74417bb refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableLineString.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 7a9324ff54b5ca989a0c5a535c3f45dec74417bb refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableMeasure.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Ringtoets.AssemblyTool.IO.csproj
===================================================================
diff -u -r7deb19aedd02c79cf6ce19e629fec1a6c0ee4e1e -r7a9324ff54b5ca989a0c5a535c3f45dec74417bb
--- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Ringtoets.AssemblyTool.IO.csproj (.../Ringtoets.AssemblyTool.IO.csproj) (revision 7deb19aedd02c79cf6ce19e629fec1a6c0ee4e1e)
+++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Ringtoets.AssemblyTool.IO.csproj (.../Ringtoets.AssemblyTool.IO.csproj) (revision 7a9324ff54b5ca989a0c5a535c3f45dec74417bb)
@@ -34,10 +34,10 @@
-
+
-
-
+
+
Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/DataTypes/SerializableLineStringTest.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/DataTypes/SerializableLineStringTest.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/DataTypes/SerializableLineStringTest.cs (revision 7a9324ff54b5ca989a0c5a535c3f45dec74417bb)
@@ -0,0 +1,83 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Globalization;
+using System.Linq;
+using Core.Common.Base.Geometry;
+using NUnit.Framework;
+using Ringtoets.AssemblyTool.IO.Model.DataTypes;
+using Ringtoets.AssemblyTool.IO.TestUtil;
+
+namespace Ringtoets.AssemblyTool.IO.Test.Model.DataTypes
+{
+ [TestFixture]
+ public class SerializableLineStringTest
+ {
+ [Test]
+ public void DefaultConstructor_ReturnsDefaultValues()
+ {
+ // Call
+ var lineString = new SerializableLineString();
+
+ // Assert
+ Assert.AreEqual("EPSG:28992", lineString.CoordinateSystem);
+ Assert.IsNull(lineString.Geometry);
+
+ SerializableAttributeTestHelper.AssertXmlAttributeAttribute(
+ nameof(SerializableLineString.CoordinateSystem), "srsName");
+
+ SerializableAttributeTestHelper.AssertXmlElementAttribute(
+ nameof(SerializableLineString.Geometry), "posList");
+ }
+
+ [Test]
+ public void Constructor_GeometryNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new SerializableLineString(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("geometry", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_WithValidData_ReturnsExpectedValues()
+ {
+ // Setup
+ var random = new Random(39);
+ var geometry = new[]
+ {
+ new Point2D(random.NextDouble(), random.NextDouble()),
+ new Point2D(random.NextDouble(), random.NextDouble())
+ };
+
+ // Call
+ var lineString = new SerializableLineString(geometry);
+
+ // Assert
+ Assert.AreEqual("EPSG:28992", lineString.CoordinateSystem);
+ Assert.AreEqual(geometry.Select(c => c.X.ToString(CultureInfo.InvariantCulture) + " " + c.Y.ToString(CultureInfo.InvariantCulture))
+ .Aggregate((c1, c2) => c1 + " " + c2), lineString.Geometry);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/DataTypes/SerializableLineTest.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/DataTypes/SerializableLineTest.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/DataTypes/SerializableLineTest.cs (revision 7a9324ff54b5ca989a0c5a535c3f45dec74417bb)
@@ -0,0 +1,78 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Globalization;
+using System.Linq;
+using Core.Common.Base.Geometry;
+using NUnit.Framework;
+using Ringtoets.AssemblyTool.IO.Model.DataTypes;
+using Ringtoets.AssemblyTool.IO.TestUtil;
+
+namespace Ringtoets.AssemblyTool.IO.Test.Model.DataTypes
+{
+ [TestFixture]
+ public class SerializableLineTest
+ {
+ [Test]
+ public void DefaultConstructor_ReturnsDefaultValues()
+ {
+ // Call
+ var line = new SerializableLine();
+
+ // Assert
+ Assert.IsNull(line.LineString);
+
+ SerializableAttributeTestHelper.AssertXmlElementAttribute(
+ nameof(SerializableLine.LineString), "LineString", "http://www.opengis.net/gml/3.2");
+ }
+
+ [Test]
+ public void Constructor_GeometryNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new SerializableLine(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("geometry", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_WithValidData_ReturnsExpectedValues()
+ {
+ // Setup
+ var random = new Random(39);
+ var geometry = new[]
+ {
+ new Point2D(random.NextDouble(), random.NextDouble()),
+ new Point2D(random.NextDouble(), random.NextDouble())
+ };
+
+ // Call
+ var line = new SerializableLine(geometry);
+
+ // Assert
+ Assert.AreEqual(geometry.Select(c => c.X.ToString(CultureInfo.InvariantCulture) + " " + c.Y.ToString(CultureInfo.InvariantCulture))
+ .Aggregate((c1, c2) => c1 + " " + c2), line.LineString.Geometry);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/DataTypes/SerializableMeasureTest.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/DataTypes/SerializableMeasureTest.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/DataTypes/SerializableMeasureTest.cs (revision 7a9324ff54b5ca989a0c5a535c3f45dec74417bb)
@@ -0,0 +1,80 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Xml.Serialization;
+using Core.Common.Util.Reflection;
+using NUnit.Framework;
+using Ringtoets.AssemblyTool.IO.Model.DataTypes;
+using Ringtoets.AssemblyTool.IO.TestUtil;
+
+namespace Ringtoets.AssemblyTool.IO.Test.Model.DataTypes
+{
+ [TestFixture]
+ public class SerializableMeasureTest
+ {
+ [Test]
+ public void DefaultConstructor_ReturnsDefaultValues()
+ {
+ // Call
+ var measure = new SerializableMeasure();
+
+ // Assert
+ Assert.IsNull(measure.UnitOfMeasure);
+ Assert.IsNaN(measure.Value);
+
+ SerializableAttributeTestHelper.AssertXmlAttributeAttribute(
+ nameof(SerializableMeasure.UnitOfMeasure), "uom");
+
+ IEnumerable xmlTextAttributes = TypeUtils.GetPropertyAttributes(
+ nameof(SerializableMeasure.Value));
+ Assert.AreEqual(1, xmlTextAttributes.Count());
+ }
+
+ [Test]
+ public void Constructor_UnitOfMeasureNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new SerializableMeasure(null, new Random(39).NextDouble());
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("unitOfMeasure", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_WithValidData_ReturnsExpectedValues()
+ {
+ // Setup
+ const string unit = "absolute";
+ double value = new Random(39).NextDouble();
+
+ // Call
+ var measure = new SerializableMeasure(unit, value);
+
+ // Assert
+ Assert.AreEqual(unit, measure.UnitOfMeasure);
+ Assert.AreEqual(value, measure.Value);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 7a9324ff54b5ca989a0c5a535c3f45dec74417bb refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableLineStringTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 7a9324ff54b5ca989a0c5a535c3f45dec74417bb refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableLineTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 7a9324ff54b5ca989a0c5a535c3f45dec74417bb refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableMeasureTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Ringtoets.AssemblyTool.IO.Test.csproj
===================================================================
diff -u -r7deb19aedd02c79cf6ce19e629fec1a6c0ee4e1e -r7a9324ff54b5ca989a0c5a535c3f45dec74417bb
--- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Ringtoets.AssemblyTool.IO.Test.csproj (.../Ringtoets.AssemblyTool.IO.Test.csproj) (revision 7deb19aedd02c79cf6ce19e629fec1a6c0ee4e1e)
+++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Ringtoets.AssemblyTool.IO.Test.csproj (.../Ringtoets.AssemblyTool.IO.Test.csproj) (revision 7a9324ff54b5ca989a0c5a535c3f45dec74417bb)
@@ -30,9 +30,9 @@
-
-
-
+
+
+