Index: Core/Common/src/Core.Common.Utils/FileUtils.cs =================================================================== diff -u -ra8bfedc443289dd37ebd3c2304d4c4add4ef7d58 -r1e3de334f82be7cffe88d7e80dc336fcdec81086 --- Core/Common/src/Core.Common.Utils/FileUtils.cs (.../FileUtils.cs) (revision a8bfedc443289dd37ebd3c2304d4c4add4ef7d58) +++ Core/Common/src/Core.Common.Utils/FileUtils.cs (.../FileUtils.cs) (revision 1e3de334f82be7cffe88d7e80dc336fcdec81086) @@ -47,7 +47,7 @@ /// public static void ValidateFilePath(string path) { - if (String.IsNullOrWhiteSpace(path)) + if (string.IsNullOrWhiteSpace(path)) { var message = new FileReaderErrorMessageBuilder(path).Build(Resources.Error_Path_must_be_specified); throw new ArgumentException(message); Index: Core/Common/test/Core.Common.TestUtil/TestDataPath.cs =================================================================== diff -u -ra91af2b4cf186d4c53e839f6ce44b2ffc2895831 -r1e3de334f82be7cffe88d7e80dc336fcdec81086 --- Core/Common/test/Core.Common.TestUtil/TestDataPath.cs (.../TestDataPath.cs) (revision a91af2b4cf186d4c53e839f6ce44b2ffc2895831) +++ Core/Common/test/Core.Common.TestUtil/TestDataPath.cs (.../TestDataPath.cs) (revision 1e3de334f82be7cffe88d7e80dc336fcdec81086) @@ -75,6 +75,11 @@ public static readonly TestDataPath Service = System.IO.Path.Combine("Ringtoets", "Common", "test", "Ringtoets.Common.Service.Test"); } + public static class DuneErosion + { + public static readonly TestDataPath IO = System.IO.Path.Combine("Ringtoets", "DuneErosion", "test", "Ringtoets.DuneErosion.IO.Test"); + } + public static class GrassCoverErosionInwards { public static readonly TestDataPath Integration = System.IO.Path.Combine("Ringtoets", "GrassCoverErosionInwards", "test", "Ringtoets.GrassCoverErosionInwards.Integration.Test"); Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.IO/DuneLocationsExporter.cs =================================================================== diff -u --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.IO/DuneLocationsExporter.cs (revision 0) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.IO/DuneLocationsExporter.cs (revision 1e3de334f82be7cffe88d7e80dc336fcdec81086) @@ -0,0 +1,70 @@ +// Copyright (C) Stichting Deltares 2016. 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 Core.Common.Base.IO; +using Core.Common.Utils; +using Ringtoets.DuneErosion.Data; + +namespace Ringtoets.DuneErosion.IO +{ + /// + /// Exports dune locations and stores them as a bnd file. + /// + public class DuneLocationsExporter : IFileExporter + { + private readonly IEnumerable duneLocations; + private readonly string filePath; + + /// + /// Creates a new instance of . + /// + /// The dune locations to export. + /// The path of the file to export to. + /// Thrown when . + /// Thrown when is invalid + /// or an from is null. + public DuneLocationsExporter(IEnumerable duneLocations, string filePath) + { + if (duneLocations == null) + { + throw new ArgumentNullException("duneLocations"); + } + + if (duneLocations.Any(location => location.Output == null)) + { + throw new ArgumentException("Locations should contain output"); + } + + FileUtils.ValidateFilePath(filePath); + + this.duneLocations = duneLocations; + this.filePath = filePath; + } + + public bool Export() + { + return true; + } + } +} \ No newline at end of file Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.IO/Ringtoets.DuneErosion.IO.csproj =================================================================== diff -u -r9717724b58f9be090380d74ba4d30c74ba81eb0c -r1e3de334f82be7cffe88d7e80dc336fcdec81086 --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.IO/Ringtoets.DuneErosion.IO.csproj (.../Ringtoets.DuneErosion.IO.csproj) (revision 9717724b58f9be090380d74ba4d30c74ba81eb0c) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.IO/Ringtoets.DuneErosion.IO.csproj (.../Ringtoets.DuneErosion.IO.csproj) (revision 1e3de334f82be7cffe88d7e80dc336fcdec81086) @@ -39,6 +39,7 @@ Properties\GlobalAssembly.cs + Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.TestUtil.Test/Ringtoets.DuneErosion.Data.TestUtil.Test.csproj =================================================================== diff -u -rb887e0d83a9ce38d959cc7d3ebbb4407a6bec416 -r1e3de334f82be7cffe88d7e80dc336fcdec81086 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.TestUtil.Test/Ringtoets.DuneErosion.Data.TestUtil.Test.csproj (.../Ringtoets.DuneErosion.Data.TestUtil.Test.csproj) (revision b887e0d83a9ce38d959cc7d3ebbb4407a6bec416) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.TestUtil.Test/Ringtoets.DuneErosion.Data.TestUtil.Test.csproj (.../Ringtoets.DuneErosion.Data.TestUtil.Test.csproj) (revision 1e3de334f82be7cffe88d7e80dc336fcdec81086) @@ -50,6 +50,7 @@ Properties\GlobalAssembly.cs + @@ -63,6 +64,10 @@ {3BBFD65B-B277-4E50-AE6D-BD24C3434609} Core.Common.Base + + {D4200F43-3F72-4F42-AF0A-8CED416A38EC} + Ringtoets.Common.Data + {d1068432-c172-4aa6-847b-d9deb4c6de26} Ringtoets.DuneErosion.Data Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.TestUtil.Test/TestDuneLocationOutputTest.cs =================================================================== diff -u --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.TestUtil.Test/TestDuneLocationOutputTest.cs (revision 0) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.TestUtil.Test/TestDuneLocationOutputTest.cs (revision 1e3de334f82be7cffe88d7e80dc336fcdec81086) @@ -0,0 +1,48 @@ +// Copyright (C) Stichting Deltares 2016. 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 NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics; + +namespace Ringtoets.DuneErosion.Data.TestUtil.Test +{ + [TestFixture] + public class TestDuneLocationOutputTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var output = new TestDuneLocationOutput(); + + // Assert + Assert.IsInstanceOf(output); + Assert.AreEqual(0, output.WaterLevel.Value); + Assert.AreEqual(0, output.WaveHeight.Value); + Assert.AreEqual(0, output.WavePeriod.Value); + Assert.AreEqual(0, output.TargetReliability.Value); + Assert.AreEqual(0, output.TargetProbability); + Assert.AreEqual(0, output.CalculatedReliability.Value); + Assert.AreEqual(0, output.CalculatedProbability); + Assert.AreEqual(CalculationConvergence.CalculatedConverged, output.CalculationConvergence); + } + } +} \ No newline at end of file Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.TestUtil/Ringtoets.DuneErosion.Data.TestUtil.csproj =================================================================== diff -u -r179b85228f5a860ff30681827920f25be1116c56 -r1e3de334f82be7cffe88d7e80dc336fcdec81086 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.TestUtil/Ringtoets.DuneErosion.Data.TestUtil.csproj (.../Ringtoets.DuneErosion.Data.TestUtil.csproj) (revision 179b85228f5a860ff30681827920f25be1116c56) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.TestUtil/Ringtoets.DuneErosion.Data.TestUtil.csproj (.../Ringtoets.DuneErosion.Data.TestUtil.csproj) (revision 1e3de334f82be7cffe88d7e80dc336fcdec81086) @@ -47,6 +47,7 @@ + @@ -58,6 +59,10 @@ {3BBFD65B-B277-4E50-AE6D-BD24C3434609} Core.Common.Base + + {D4200F43-3F72-4F42-AF0A-8CED416A38EC} + Ringtoets.Common.Data + {D1068432-C172-4AA6-847B-D9DEB4C6DE26} Ringtoets.DuneErosion.Data Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.TestUtil/TestDuneLocationOutput.cs =================================================================== diff -u --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.TestUtil/TestDuneLocationOutput.cs (revision 0) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.TestUtil/TestDuneLocationOutput.cs (revision 1e3de334f82be7cffe88d7e80dc336fcdec81086) @@ -0,0 +1,38 @@ +// Copyright (C) Stichting Deltares 2016. 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 Ringtoets.Common.Data.Hydraulics; + +namespace Ringtoets.DuneErosion.Data.TestUtil +{ + /// + /// Class that creates simple instances of that + /// can be used during testing. + /// + public class TestDuneLocationOutput : DuneLocationOutput + { + /// + /// Creates a new instance of . + /// + public TestDuneLocationOutput() + : base(0, 0, 0, 0, 0, 0, 0, CalculationConvergence.CalculatedConverged) {} + } +} \ No newline at end of file Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.IO.Test/DuneLocationsExporterTest.cs =================================================================== diff -u --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.IO.Test/DuneLocationsExporterTest.cs (revision 0) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.IO.Test/DuneLocationsExporterTest.cs (revision 1e3de334f82be7cffe88d7e80dc336fcdec81086) @@ -0,0 +1,99 @@ +// Copyright (C) Stichting Deltares 2016. 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.IO; +using System.Linq; +using Core.Common.Base.IO; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.DuneErosion.Data; +using Ringtoets.DuneErosion.Data.TestUtil; + +namespace Ringtoets.DuneErosion.IO.Test +{ + [TestFixture] + public class DuneLocationsExporterTest + { + private static readonly string testDataPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.DuneErosion.IO, "DuneLocationsExporter"); + + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var filePath = Path.Combine(testDataPath, "tets.bnd"); + + // Call + var exporter = new DuneLocationsExporter(Enumerable.Empty(), filePath); + + // Assert + Assert.IsInstanceOf(exporter); + } + + [Test] + public void Constructor_LocationsNull_ThrowArgumentNullException() + { + // Setup + var filePath = Path.Combine(testDataPath, "tets.bnd"); + + // Call + TestDelegate test = () => new DuneLocationsExporter(null, filePath); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("duneLocations", exception.ParamName); + } + + [Test] + public void Constructor_LocationWithoutOutput_ThrowArgumentException() + { + // Setup + var filePath = Path.Combine(testDataPath, "tets.bnd"); + + var location1 = new TestDuneLocation + { + Output = new TestDuneLocationOutput() + }; + var location2 = new TestDuneLocation(); + + // Call + TestDelegate test = () => new DuneLocationsExporter(new[] + { + location1, + location2 + }, filePath); + + // Assert + var expectedMessage = "Locations should contain output"; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); + } + + [Test] + public void Constructor_FilePathInvalid_ThrowArgumentException() + { + // Call + TestDelegate test = () => new DuneLocationsExporter(Enumerable.Empty(), null); + + // Assert + Assert.Throws(test); + } + } +} \ No newline at end of file Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.IO.Test/Ringtoets.DuneErosion.IO.Test.csproj =================================================================== diff -u -r9717724b58f9be090380d74ba4d30c74ba81eb0c -r1e3de334f82be7cffe88d7e80dc336fcdec81086 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.IO.Test/Ringtoets.DuneErosion.IO.Test.csproj (.../Ringtoets.DuneErosion.IO.Test.csproj) (revision 9717724b58f9be090380d74ba4d30c74ba81eb0c) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.IO.Test/Ringtoets.DuneErosion.IO.Test.csproj (.../Ringtoets.DuneErosion.IO.Test.csproj) (revision 1e3de334f82be7cffe88d7e80dc336fcdec81086) @@ -49,6 +49,7 @@ Properties\GlobalAssembly.cs + @@ -64,6 +65,10 @@ {3bbfd65b-b277-4e50-ae6d-bd24c3434609} Core.Common.Base + + {D749EE4C-CE50-4C17-BF01-9A953028C126} + Core.Common.TestUtil + {d4200f43-3f72-4f42-af0a-8ced416a38ec} Ringtoets.Common.Data @@ -80,6 +85,10 @@ {EDDC30E9-D793-478A-AD37-9F257CE23A22} Ringtoets.DuneErosion.IO + + {7BE6B522-02E3-4143-8508-C021A211DE54} + Ringtoets.DuneErosion.Data.TestUtil +