Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/Gml/SerializableEnvelope.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/Gml/SerializableEnvelope.cs (revision 0) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/Gml/SerializableEnvelope.cs (revision a3cd7fd4246c7b90ed5f1ce17a7a79aa64e2ff9a) @@ -0,0 +1,72 @@ +// 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; +using Core.Common.Base.Geometry; + +namespace Ringtoets.AssemblyTool.IO.Model.Gml +{ + /// + /// Class containing the data describing a GML Envelope object + /// + public class SerializableEnvelope + { + /// + /// Creates a new instance of . + /// + public SerializableEnvelope() {} + + /// + /// Creates a new instance of . + /// + /// The lower corner of the envelope. + /// The upper corner of the envelope. + /// Thrown when any parameter is null. + public SerializableEnvelope(Point2D lowerCorner, Point2D upperCorner) + { + if (lowerCorner == null) + { + throw new ArgumentNullException(nameof(lowerCorner)); + } + + if (upperCorner == null) + { + throw new ArgumentNullException(nameof(upperCorner)); + } + + LowerCorner = lowerCorner.X + " " + lowerCorner.Y; + UpperCorner = upperCorner.X + " " + upperCorner.Y; + } + + /// + /// The coordinates of the lower corner of the envelope. + /// + [XmlElement(AssemblyXmlIdentifiers.LowerCorner, Namespace = AssemblyXmlIdentifiers.GmlNamespace)] + public string LowerCorner { get; set; } + + /// + /// The coordinates of the upper corner of the envelope. + /// + [XmlElement(AssemblyXmlIdentifiers.UpperCorner, Namespace = AssemblyXmlIdentifiers.GmlNamespace)] + public string UpperCorner { get; set; } + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Ringtoets.AssemblyTool.IO.csproj =================================================================== diff -u -r030608f6fe16d9b15edb1be2fb191526ae15a32c -ra3cd7fd4246c7b90ed5f1ce17a7a79aa64e2ff9a --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Ringtoets.AssemblyTool.IO.csproj (.../Ringtoets.AssemblyTool.IO.csproj) (revision 030608f6fe16d9b15edb1be2fb191526ae15a32c) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Ringtoets.AssemblyTool.IO.csproj (.../Ringtoets.AssemblyTool.IO.csproj) (revision a3cd7fd4246c7b90ed5f1ce17a7a79aa64e2ff9a) @@ -16,6 +16,7 @@ + \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/Gml/SerializableEnvelopeTest.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/Gml/SerializableEnvelopeTest.cs (revision 0) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/Gml/SerializableEnvelopeTest.cs (revision a3cd7fd4246c7b90ed5f1ce17a7a79aa64e2ff9a) @@ -0,0 +1,92 @@ +// 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 Core.Common.Base.Geometry; +using NUnit.Framework; +using Ringtoets.AssemblyTool.IO.Model.Gml; +using Ringtoets.AssemblyTool.IO.TestUtil; + +namespace Ringtoets.AssemblyTool.IO.Test.Model.Gml +{ + public class SerializableEnvelopeTest + { + [Test] + public void DefaultConstructor_ReturnsDefaultValues() + { + // Call + var boundaries = new SerializableEnvelope(); + + // Assert + Assert.IsNull(boundaries.LowerCorner); + Assert.IsNull(boundaries.UpperCorner); + + SerializableAttributeTestHelper.AssertXmlElementAttribute( + nameof(SerializableEnvelope.LowerCorner), "lowerCorner", "http://www.opengis.net/gml/3.2"); + SerializableAttributeTestHelper.AssertXmlElementAttribute( + nameof(SerializableEnvelope.UpperCorner), "upperCorner", "http://www.opengis.net/gml/3.2"); + } + + [Test] + public void Constructor_LowerCornerNull_ThrowsArgumentNullException() + { + // Setup + var random = new Random(39); + + // Call + TestDelegate call = () => new SerializableEnvelope(null, new Point2D(random.NextDouble(), random.NextDouble())); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("lowerCorner", exception.ParamName); + } + + [Test] + public void Constructor_UpperCornerNull_ThrowsArgumentNullException() + { + // Setup + var random = new Random(39); + + // Call + TestDelegate call = () => new SerializableEnvelope(new Point2D(random.NextDouble(), random.NextDouble()), null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("upperCorner", exception.ParamName); + } + + [Test] + public void Constructor_WithCorners_ReturnsExpectedValues() + { + // Setup + var random = new Random(39); + var lowerCorner = new Point2D(random.NextDouble(), random.NextDouble()); + var upperCorner = new Point2D(random.NextDouble(), random.NextDouble()); + + // Call + var boundaries = new SerializableEnvelope(lowerCorner, upperCorner); + + // Assert + Assert.AreEqual(lowerCorner.X + " " + lowerCorner.Y, boundaries.LowerCorner); + Assert.AreEqual(upperCorner.X + " " + upperCorner.Y, boundaries.UpperCorner); + } + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Ringtoets.AssemblyTool.IO.Test.csproj =================================================================== diff -u -r030608f6fe16d9b15edb1be2fb191526ae15a32c -ra3cd7fd4246c7b90ed5f1ce17a7a79aa64e2ff9a --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Ringtoets.AssemblyTool.IO.Test.csproj (.../Ringtoets.AssemblyTool.IO.Test.csproj) (revision 030608f6fe16d9b15edb1be2fb191526ae15a32c) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Ringtoets.AssemblyTool.IO.Test.csproj (.../Ringtoets.AssemblyTool.IO.Test.csproj) (revision a3cd7fd4246c7b90ed5f1ce17a7a79aa64e2ff9a) @@ -13,6 +13,7 @@ +