Fisheye: Tag 3ef793ff9988c152c373edf9a821bb50e88db36f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Handlers/HydraulicLocationConfigurationSettingsUpdateHelper.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Helpers/HydraulicLocationConfigurationSettingsConstants.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Helpers/HydraulicLocationConfigurationSettingsConstants.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Helpers/HydraulicLocationConfigurationSettingsConstants.cs (revision 3ef793ff9988c152c373edf9a821bb50e88db36f) @@ -0,0 +1,36 @@ +// Copyright (C) Stichting Deltares 2018. 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.Integration.Plugin.Helpers +{ + /// + /// Constants for dealing with . + /// + internal static class HydraulicLocationConfigurationSettingsConstants + { + internal const string MandatoryConfigurationPropertyDefaultValue = "WBI2017"; + internal const int YearDefaultValue = 2023; + internal const string OptionalConfigurationPropertyDefaultValue = "Conform WBI2017"; + internal const string AdditionalInformationConfigurationPropertyValue = "Gegenereerd door Ringtoets (conform WBI2017)"; + } +} Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Helpers/HydraulicLocationConfigurationSettingsUpdateHelper.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Helpers/HydraulicLocationConfigurationSettingsUpdateHelper.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Helpers/HydraulicLocationConfigurationSettingsUpdateHelper.cs (revision 3ef793ff9988c152c373edf9a821bb50e88db36f) @@ -0,0 +1,83 @@ +// Copyright (C) Stichting Deltares 2018. 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 Ringtoets.Common.Data.Hydraulics; +using Ringtoets.HydraRing.IO.HydraulicLocationConfigurationDatabase; + +namespace Ringtoets.Integration.Plugin.Helpers +{ + /// + /// Helper class for dealing with updating + /// + public static class HydraulicLocationConfigurationSettingsUpdateHelper + { + /// + /// Sets the hydraulic location configuration settings. + /// + /// The hydraulic location configuration settings to set on. + /// The read settings to set. + /// The hlcd file path. + /// Thrown when + /// or is null. + public static void SetHydraulicLocationConfigurationSettings(HydraulicLocationConfigurationSettings hydraulicLocationConfigurationSettings, + ReadHydraulicLocationConfigurationDatabaseSettings readHydraulicLocationConfigurationDatabaseSettings, + string hlcdFilePath) + { + if (hydraulicLocationConfigurationSettings == null) + { + throw new ArgumentNullException(nameof(hydraulicLocationConfigurationSettings)); + } + + if (hlcdFilePath == null) + { + throw new ArgumentNullException(nameof(hlcdFilePath)); + } + + if (readHydraulicLocationConfigurationDatabaseSettings != null) + { + hydraulicLocationConfigurationSettings.SetValues(hlcdFilePath, + readHydraulicLocationConfigurationDatabaseSettings.ScenarioName, + readHydraulicLocationConfigurationDatabaseSettings.Year, + readHydraulicLocationConfigurationDatabaseSettings.Scope, + readHydraulicLocationConfigurationDatabaseSettings.SeaLevel, + readHydraulicLocationConfigurationDatabaseSettings.RiverDischarge, + readHydraulicLocationConfigurationDatabaseSettings.LakeLevel, + readHydraulicLocationConfigurationDatabaseSettings.WindDirection, + readHydraulicLocationConfigurationDatabaseSettings.WindSpeed, + readHydraulicLocationConfigurationDatabaseSettings.Comment); + } + else + { + hydraulicLocationConfigurationSettings.SetValues(hlcdFilePath, + HydraulicLocationConfigurationSettingsConstants.MandatoryConfigurationPropertyDefaultValue, + HydraulicLocationConfigurationSettingsConstants.YearDefaultValue, + HydraulicLocationConfigurationSettingsConstants.MandatoryConfigurationPropertyDefaultValue, + HydraulicLocationConfigurationSettingsConstants.OptionalConfigurationPropertyDefaultValue, + HydraulicLocationConfigurationSettingsConstants.OptionalConfigurationPropertyDefaultValue, + HydraulicLocationConfigurationSettingsConstants.OptionalConfigurationPropertyDefaultValue, + HydraulicLocationConfigurationSettingsConstants.OptionalConfigurationPropertyDefaultValue, + HydraulicLocationConfigurationSettingsConstants.OptionalConfigurationPropertyDefaultValue, + HydraulicLocationConfigurationSettingsConstants.AdditionalInformationConfigurationPropertyValue); + } + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/AssemblyInfo.cs =================================================================== diff -u -r2a81f01756e227d5ce93717b21b87e8a5cd5fcbb -r3ef793ff9988c152c373edf9a821bb50e88db36f --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/AssemblyInfo.cs (.../AssemblyInfo.cs) (revision 2a81f01756e227d5ce93717b21b87e8a5cd5fcbb) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/AssemblyInfo.cs (.../AssemblyInfo.cs) (revision 3ef793ff9988c152c373edf9a821bb50e88db36f) @@ -20,6 +20,8 @@ // All rights reserved. using System.Reflection; +using System.Runtime.CompilerServices; [assembly: AssemblyTitle("Ringtoets.Integration.Plugin")] -[assembly: AssemblyProduct("Ringtoets.Integration.Plugin")] \ No newline at end of file +[assembly: AssemblyProduct("Ringtoets.Integration.Plugin")] +[assembly: InternalsVisibleTo("Ringtoets.Integration.Plugin.Test")] \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Ringtoets.Integration.Plugin.csproj =================================================================== diff -u -re70c9af09ba41246d00821ac282a96c3a6130447 -r3ef793ff9988c152c373edf9a821bb50e88db36f --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Ringtoets.Integration.Plugin.csproj (.../Ringtoets.Integration.Plugin.csproj) (revision e70c9af09ba41246d00821ac282a96c3a6130447) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Ringtoets.Integration.Plugin.csproj (.../Ringtoets.Integration.Plugin.csproj) (revision 3ef793ff9988c152c373edf9a821bb50e88db36f) @@ -34,7 +34,8 @@ - + + Fisheye: Tag 3ef793ff9988c152c373edf9a821bb50e88db36f refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Handlers/HydraulicLocationConfigurationSettingsUpdateHelperTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Helpers/HydraulicLocationConfigurationSettingsConstantsTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Helpers/HydraulicLocationConfigurationSettingsConstantsTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Helpers/HydraulicLocationConfigurationSettingsConstantsTest.cs (revision 3ef793ff9988c152c373edf9a821bb50e88db36f) @@ -0,0 +1,39 @@ +// Copyright (C) Stichting Deltares 2018. 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.Integration.Plugin.Helpers; + +namespace Ringtoets.Integration.Plugin.Test.Helpers +{ + [TestFixture] + public class HydraulicLocationConfigurationSettingsConstantsTest + { + [Test] + public void Constants_ExpectedValues() + { + Assert.AreEqual("WBI2017", HydraulicLocationConfigurationSettingsConstants.MandatoryConfigurationPropertyDefaultValue); + Assert.AreEqual(2023, HydraulicLocationConfigurationSettingsConstants.YearDefaultValue); + Assert.AreEqual("Conform WBI2017", HydraulicLocationConfigurationSettingsConstants.OptionalConfigurationPropertyDefaultValue); + Assert.AreEqual("Gegenereerd door Ringtoets (conform WBI2017)", HydraulicLocationConfigurationSettingsConstants.AdditionalInformationConfigurationPropertyValue); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Helpers/HydraulicLocationConfigurationSettingsUpdateHelperTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Helpers/HydraulicLocationConfigurationSettingsUpdateHelperTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Helpers/HydraulicLocationConfigurationSettingsUpdateHelperTest.cs (revision 3ef793ff9988c152c373edf9a821bb50e88db36f) @@ -0,0 +1,105 @@ +// Copyright (C) Stichting Deltares 2018. 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 NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.HydraRing.IO.HydraulicLocationConfigurationDatabase; +using Ringtoets.HydraRing.IO.TestUtil; +using Ringtoets.Integration.Plugin.Helpers; + +namespace Ringtoets.Integration.Plugin.Test.Helpers +{ + [TestFixture] + public class HydraulicLocationConfigurationSettingsUpdateHelperTest + { + [Test] + public void SetHydraulicLocationConfigurationSettings_HydraulicLocationConfigurationSettingsNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => HydraulicLocationConfigurationSettingsUpdateHelper.SetHydraulicLocationConfigurationSettings( + null, ReadHydraulicLocationConfigurationDatabaseSettingsTestFactory.Create(), ""); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("hydraulicLocationConfigurationSettings", exception.ParamName); + } + + [Test] + public void SetHydraulicLocationConfigurationSettings_HlcdFilePathNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => HydraulicLocationConfigurationSettingsUpdateHelper.SetHydraulicLocationConfigurationSettings( + new HydraulicLocationConfigurationSettings(), ReadHydraulicLocationConfigurationDatabaseSettingsTestFactory.Create(), null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("hlcdFilePath", exception.ParamName); + } + + [Test] + public void SetHydraulicLocationConfigurationSettings_ReadHydraulicLocationConfigurationDatabaseSettingsNull_SetDefaultValues() + { + // Setup + const string filePath = "some/file/path"; + var settings = new HydraulicLocationConfigurationSettings(); + + // Call + HydraulicLocationConfigurationSettingsUpdateHelper.SetHydraulicLocationConfigurationSettings(settings, null, filePath); + + // Assert + Assert.AreEqual(filePath, settings.FilePath); + Assert.AreEqual("WBI2017", settings.ScenarioName); + Assert.AreEqual(2023, settings.Year); + Assert.AreEqual("WBI2017", settings.Scope); + Assert.AreEqual("Conform WBI2017", settings.SeaLevel); + Assert.AreEqual("Conform WBI2017", settings.RiverDischarge); + Assert.AreEqual("Conform WBI2017", settings.LakeLevel); + Assert.AreEqual("Conform WBI2017", settings.WindDirection); + Assert.AreEqual("Conform WBI2017", settings.WindSpeed); + Assert.AreEqual("Gegenereerd door Ringtoets (conform WBI2017)", settings.Comment); + } + + [Test] + public void SetHydraulicLocationConfigurationSettings_ReadHydraulicLocationConfigurationDatabaseSettingsNotNull_SetExpectedValues() + { + // Setup + const string filePath = "some/file/path"; + var settings = new HydraulicLocationConfigurationSettings(); + ReadHydraulicLocationConfigurationDatabaseSettings readSettings = ReadHydraulicLocationConfigurationDatabaseSettingsTestFactory.Create(); + + // Call + HydraulicLocationConfigurationSettingsUpdateHelper.SetHydraulicLocationConfigurationSettings(settings, readSettings, filePath); + + // Assert + Assert.AreEqual(filePath, settings.FilePath); + Assert.AreEqual(readSettings.ScenarioName, settings.ScenarioName); + Assert.AreEqual(readSettings.Year, settings.Year); + Assert.AreEqual(readSettings.Scope, settings.Scope); + Assert.AreEqual(readSettings.SeaLevel, settings.SeaLevel); + Assert.AreEqual(readSettings.RiverDischarge, settings.RiverDischarge); + Assert.AreEqual(readSettings.LakeLevel, settings.LakeLevel); + Assert.AreEqual(readSettings.WindDirection, settings.WindDirection); + Assert.AreEqual(readSettings.WindSpeed, settings.WindSpeed); + Assert.AreEqual(readSettings.Comment, settings.Comment); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj =================================================================== diff -u -re70c9af09ba41246d00821ac282a96c3a6130447 -r3ef793ff9988c152c373edf9a821bb50e88db36f --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision e70c9af09ba41246d00821ac282a96c3a6130447) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 3ef793ff9988c152c373edf9a821bb50e88db36f) @@ -59,7 +59,8 @@ - + +