Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/Gml/SerializableBoundary.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/Gml/SerializableBoundary.cs (revision 0) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/Gml/SerializableBoundary.cs (revision 8dc5fd4ca0f4a2b44a65d1f7995fdc652919694d) @@ -0,0 +1,65 @@ +// 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 Bounded By object + /// + public class SerializableBoundary + { + /// + /// Creates a new instance of . + /// + public SerializableBoundary() {} + + /// + /// Creates a new instance of . + /// + /// The lower corner of the boundary. + /// The upper corner of the boundary. + /// Thrown when any parameter is null. + public SerializableBoundary(Point2D lowerCorner, Point2D upperCorner) + { + if (lowerCorner == null) + { + throw new ArgumentNullException(nameof(lowerCorner)); + } + + if (upperCorner == null) + { + throw new ArgumentNullException(nameof(upperCorner)); + } + + Envelope = new SerializableEnvelope(lowerCorner, upperCorner); + } + + /// + /// Gets or sets the envelope describing the boundary. + /// + [XmlElement(AssemblyXmlIdentifiers.Envelope)] + public SerializableEnvelope Envelope { get; set; } + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Ringtoets.AssemblyTool.IO.csproj =================================================================== diff -u -ra3cd7fd4246c7b90ed5f1ce17a7a79aa64e2ff9a -r8dc5fd4ca0f4a2b44a65d1f7995fdc652919694d --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Ringtoets.AssemblyTool.IO.csproj (.../Ringtoets.AssemblyTool.IO.csproj) (revision a3cd7fd4246c7b90ed5f1ce17a7a79aa64e2ff9a) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Ringtoets.AssemblyTool.IO.csproj (.../Ringtoets.AssemblyTool.IO.csproj) (revision 8dc5fd4ca0f4a2b44a65d1f7995fdc652919694d) @@ -17,6 +17,13 @@ + + + + {3BBFD65B-B277-4E50-AE6D-BD24C3434609} + Core.Common.Base + False + \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/Gml/SerializableBoundaryTest.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/Gml/SerializableBoundaryTest.cs (revision 0) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/Gml/SerializableBoundaryTest.cs (revision 8dc5fd4ca0f4a2b44a65d1f7995fdc652919694d) @@ -0,0 +1,89 @@ +// 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 SerializableBoundaryTest + { + [Test] + public void DefaultConstructor_ReturnsDefaultValues() + { + // Call + var boundaries = new SerializableBoundary(); + + // Assert + Assert.IsNull(boundaries.Envelope); + + SerializableAttributeTestHelper.AssertXmlElementAttribute( + nameof(SerializableBoundary.Envelope), "Envelope"); + } + + [Test] + public void Constructor_LowerCornerNull_ThrowsArgumentNullException() + { + // Setup + var random = new Random(39); + + // Call + TestDelegate call = () => new SerializableBoundary(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 SerializableBoundary(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 SerializableBoundary(lowerCorner, upperCorner); + + // Assert + Assert.AreEqual(lowerCorner.X + " " + lowerCorner.Y, boundaries.Envelope.LowerCorner); + Assert.AreEqual(upperCorner.X + " " + upperCorner.Y, boundaries.Envelope.UpperCorner); + } + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Ringtoets.AssemblyTool.IO.Test.csproj =================================================================== diff -u -ra3cd7fd4246c7b90ed5f1ce17a7a79aa64e2ff9a -r8dc5fd4ca0f4a2b44a65d1f7995fdc652919694d --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Ringtoets.AssemblyTool.IO.Test.csproj (.../Ringtoets.AssemblyTool.IO.Test.csproj) (revision a3cd7fd4246c7b90ed5f1ce17a7a79aa64e2ff9a) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Ringtoets.AssemblyTool.IO.Test.csproj (.../Ringtoets.AssemblyTool.IO.Test.csproj) (revision 8dc5fd4ca0f4a2b44a65d1f7995fdc652919694d) @@ -14,11 +14,30 @@ + Copying.licenseheader + + + {3BBFD65B-B277-4E50-AE6D-BD24C3434609} + Core.Common.Base + + + {D749EE4C-CE50-4C17-BF01-9A953028C126} + Core.Common.TestUtil + + + {b9838495-b090-4b84-a387-a8974f4f9cc4} + Ringtoets.AssemblyTool.IO + + + {C7023D25-F8DF-4E3F-BF5D-A8F961CC63F7} + Ringtoets.AssemblyTool.IO.TestUtil + + \ No newline at end of file