Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Data/Databases/HLCD.sqlite =================================================================== diff -u -r5d2266c055328eb7f13376df384683af71e3fee3 -r194139b3a9e8d221e69a4e5ff4adaa458eaedef5 Binary files differ Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Data/Ringtoets.HydraRing.Data.csproj =================================================================== diff -u -rc6dd26c14af11a7e13f783f578466e46b463165a -r194139b3a9e8d221e69a4e5ff4adaa458eaedef5 --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Data/Ringtoets.HydraRing.Data.csproj (.../Ringtoets.HydraRing.Data.csproj) (revision c6dd26c14af11a7e13f783f578466e46b463165a) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Data/Ringtoets.HydraRing.Data.csproj (.../Ringtoets.HydraRing.Data.csproj) (revision 194139b3a9e8d221e69a4e5ff4adaa458eaedef5) @@ -47,9 +47,6 @@ Copying.licenseheader - - Always - Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicLocationConfigurationDatabaseContext/HydraulicLocationConfigurationDatabaseQueryBuilder.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicLocationConfigurationDatabaseContext/HydraulicLocationConfigurationDatabaseQueryBuilder.cs (revision 0) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicLocationConfigurationDatabaseContext/HydraulicLocationConfigurationDatabaseQueryBuilder.cs (revision 194139b3a9e8d221e69a4e5ff4adaa458eaedef5) @@ -0,0 +1,46 @@ +// 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; + +namespace Ringtoets.HydraRing.IO.HydraulicLocationConfigurationDatabaseContext +{ + /// + /// Defines queries to execute on a hydraulic location configuration database. + /// + public static class HydraulicLocationConfigurationDatabaseQueryBuilder + { + /// + /// Returns the query to get the LocationId from the database, based upon and . + /// + /// The query to get the locationId from the database. + public static string GetLocationIdQuery(int regionId, int hrdLocationId) + { + return String.Format("SELECT {0} FROM {1} WHERE {2} = {3} AND {4} = {5};", + LocationsTableDefinitions.LocationId, + LocationsTableDefinitions.TableName, + LocationsTableDefinitions.RegionId, + hrdLocationId, + LocationsTableDefinitions.HrdLocationId, + regionId); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicLocationConfigurationDatabaseContext/LocationsTableDefinitions.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicLocationConfigurationDatabaseContext/LocationsTableDefinitions.cs (revision 0) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicLocationConfigurationDatabaseContext/LocationsTableDefinitions.cs (revision 194139b3a9e8d221e69a4e5ff4adaa458eaedef5) @@ -0,0 +1,35 @@ +// 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. + +namespace Ringtoets.HydraRing.IO.HydraulicLocationConfigurationDatabaseContext +{ + /// + /// Defines the table and column names of the table 'Locations' in the hydraulic location + /// configuration database. + /// + public static class LocationsTableDefinitions + { + internal const string TableName = "Locations"; + internal const string LocationId = "LocationId"; + internal const string HrdLocationId = "HRDLocationId"; + internal const string RegionId = "RegionId"; + } +} \ No newline at end of file Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/Ringtoets.HydraRing.IO.csproj =================================================================== diff -u -r7c7aa064bf7718dcdf9dc373f9eba77418cde957 -r194139b3a9e8d221e69a4e5ff4adaa458eaedef5 --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/Ringtoets.HydraRing.IO.csproj (.../Ringtoets.HydraRing.IO.csproj) (revision 7c7aa064bf7718dcdf9dc373f9eba77418cde957) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/Ringtoets.HydraRing.IO.csproj (.../Ringtoets.HydraRing.IO.csproj) (revision 194139b3a9e8d221e69a4e5ff4adaa458eaedef5) @@ -51,6 +51,8 @@ + + True @@ -93,6 +95,7 @@ Resources.Designer.cs + Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/HydraulicLocationConfigurationDatabaseContext/HydraulicLocationConfigurationDatabaseQueryBuilderTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/HydraulicLocationConfigurationDatabaseContext/HydraulicLocationConfigurationDatabaseQueryBuilderTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/HydraulicLocationConfigurationDatabaseContext/HydraulicLocationConfigurationDatabaseQueryBuilderTest.cs (revision 194139b3a9e8d221e69a4e5ff4adaa458eaedef5) @@ -0,0 +1,46 @@ +// 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 NUnit.Framework; +using Ringtoets.HydraRing.IO.HydraulicLocationConfigurationDatabaseContext; + +namespace Ringtoets.HydraRing.IO.Test.HydraulicLocationConfigurationDatabaseContext +{ + [TestFixture] + public class HydraulicLocationConfigurationDatabaseQueryBuilderTest + { + [Test] + [TestCase(1, 2)] + [TestCase(18, 8537)] + public void GetLocationIdQuery_Always_ReturnsExpectedValues(int regionId, int hrdLocationId) + { + // Setup + string expectedQuery = String.Format("SELECT LocationId FROM Locations WHERE RegionId = {0} AND HRDLocationId = {1};", hrdLocationId, regionId); + + // Call + string query = HydraulicLocationConfigurationDatabaseQueryBuilder.GetLocationIdQuery(regionId, hrdLocationId); + + // Assert + Assert.AreEqual(expectedQuery, query); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/Ringtoets.HydraRing.IO.Test.csproj =================================================================== diff -u -r7c7aa064bf7718dcdf9dc373f9eba77418cde957 -r194139b3a9e8d221e69a4e5ff4adaa458eaedef5 --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/Ringtoets.HydraRing.IO.Test.csproj (.../Ringtoets.HydraRing.IO.Test.csproj) (revision 7c7aa064bf7718dcdf9dc373f9eba77418cde957) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/Ringtoets.HydraRing.IO.Test.csproj (.../Ringtoets.HydraRing.IO.Test.csproj) (revision 194139b3a9e8d221e69a4e5ff4adaa458eaedef5) @@ -55,6 +55,7 @@ + @@ -85,6 +86,7 @@ Ringtoets.HydraRing.IO +