Index: Ringtoets/Migration/src/Riskeer.Migration.Core/ProjectDatabaseQueryBuilder.cs =================================================================== diff -u --- Ringtoets/Migration/src/Riskeer.Migration.Core/ProjectDatabaseQueryBuilder.cs (revision 0) +++ Ringtoets/Migration/src/Riskeer.Migration.Core/ProjectDatabaseQueryBuilder.cs (revision 8f08a982730454fd4e91b5ef635fc553e6d63707) @@ -0,0 +1,41 @@ +// 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. + +namespace Riskeer.Migration.Core +{ + /// + /// Defines queries to execute on a project database. + /// + public static class ProjectDatabaseQueryBuilder + { + /// + /// Returns the query to get the version from the project database. + /// + /// The query to get the version from the project database. + public static string GetVersionQuery() + { + return $"SELECT {VersionTableDefinitions.Version} " + + $"FROM {VersionTableDefinitions.TableName} " + + $"Order by {VersionTableDefinitions.Timestamp} DESC " + + "LIMIT 1"; + } + } +} \ No newline at end of file Fisheye: Tag 8f08a982730454fd4e91b5ef635fc553e6d63707 refers to a dead (removed) revision in file `Ringtoets/Migration/src/Riskeer.Migration.Core/RingtoetsDatabaseQueryBuilder.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Migration/src/Riskeer.Migration.Core/RingtoetsDatabaseSourceFile.cs =================================================================== diff -u -reb0ce91f3f0fb3c543ef2b1875e5ad9e6356fa08 -r8f08a982730454fd4e91b5ef635fc553e6d63707 --- Ringtoets/Migration/src/Riskeer.Migration.Core/RingtoetsDatabaseSourceFile.cs (.../RingtoetsDatabaseSourceFile.cs) (revision eb0ce91f3f0fb3c543ef2b1875e5ad9e6356fa08) +++ Ringtoets/Migration/src/Riskeer.Migration.Core/RingtoetsDatabaseSourceFile.cs (.../RingtoetsDatabaseSourceFile.cs) (revision 8f08a982730454fd4e91b5ef635fc553e6d63707) @@ -54,7 +54,7 @@ /// Ringtoets database source file. public string GetVersion() { - string versionQuery = RingtoetsDatabaseQueryBuilder.GetVersionQuery(); + string versionQuery = ProjectDatabaseQueryBuilder.GetVersionQuery(); try { using (IDataReader dataReader = CreateDataReader(versionQuery, null)) Index: Ringtoets/Migration/src/Riskeer.Migration.Core/Riskeer.Migration.Core.csproj =================================================================== diff -u -r42c365ba568e89bb0267c3788a2c46b816539244 -r8f08a982730454fd4e91b5ef635fc553e6d63707 --- Ringtoets/Migration/src/Riskeer.Migration.Core/Riskeer.Migration.Core.csproj (.../Riskeer.Migration.Core.csproj) (revision 42c365ba568e89bb0267c3788a2c46b816539244) +++ Ringtoets/Migration/src/Riskeer.Migration.Core/Riskeer.Migration.Core.csproj (.../Riskeer.Migration.Core.csproj) (revision 8f08a982730454fd4e91b5ef635fc553e6d63707) @@ -27,7 +27,7 @@ - + Index: Ringtoets/Migration/test/Riskeer.Migration.Core.Test/ProjectDatabaseQueryBuilderTest.cs =================================================================== diff -u --- Ringtoets/Migration/test/Riskeer.Migration.Core.Test/ProjectDatabaseQueryBuilderTest.cs (revision 0) +++ Ringtoets/Migration/test/Riskeer.Migration.Core.Test/ProjectDatabaseQueryBuilderTest.cs (revision 8f08a982730454fd4e91b5ef635fc553e6d63707) @@ -0,0 +1,40 @@ +// 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; + +namespace Riskeer.Migration.Core.Test +{ + [TestFixture] + public class ProjectDatabaseQueryBuilderTest + { + [Test] + public void GetVersionQuery_ReturnsExpectedQuery() + { + // Call + string getVersionQuery = ProjectDatabaseQueryBuilder.GetVersionQuery(); + + // Assert + Assert.AreEqual("SELECT Version FROM VersionEntity Order by Timestamp DESC LIMIT 1", + getVersionQuery); + } + } +} \ No newline at end of file Fisheye: Tag 8f08a982730454fd4e91b5ef635fc553e6d63707 refers to a dead (removed) revision in file `Ringtoets/Migration/test/Riskeer.Migration.Core.Test/RingtoetsDatabaseQueryBuilderTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Migration/test/Riskeer.Migration.Core.Test/Riskeer.Migration.Core.Test.csproj =================================================================== diff -u -r42c365ba568e89bb0267c3788a2c46b816539244 -r8f08a982730454fd4e91b5ef635fc553e6d63707 --- Ringtoets/Migration/test/Riskeer.Migration.Core.Test/Riskeer.Migration.Core.Test.csproj (.../Riskeer.Migration.Core.Test.csproj) (revision 42c365ba568e89bb0267c3788a2c46b816539244) +++ Ringtoets/Migration/test/Riskeer.Migration.Core.Test/Riskeer.Migration.Core.Test.csproj (.../Riskeer.Migration.Core.Test.csproj) (revision 8f08a982730454fd4e91b5ef635fc553e6d63707) @@ -24,7 +24,7 @@ - +