Index: Core/Common/src/Core.Common.Base/Geometry/Point2D.cs
===================================================================
diff -u -rdd7a5cfb0343fa2350b4143232b94cbba37612e9 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Core/Common/src/Core.Common.Base/Geometry/Point2D.cs (.../Point2D.cs) (revision dd7a5cfb0343fa2350b4143232b94cbba37612e9)
+++ Core/Common/src/Core.Common.Base/Geometry/Point2D.cs (.../Point2D.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -51,12 +51,12 @@
///
/// Gets or sets the x coordinate.
///
- public double X { get; set; }
+ public double X { get; private set; }
///
/// Gets or sets the y coordinate.
///
- public double Y { get; set; }
+ public double Y { get; private set; }
///
/// Determines the 2D vector defined by the difference of two .
Index: Core/Common/src/Core.Common.IO/Readers/SqLiteDatabaseReaderBase.cs
===================================================================
diff -u -rc6dd26c14af11a7e13f783f578466e46b463165a -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Core/Common/src/Core.Common.IO/Readers/SqLiteDatabaseReaderBase.cs (.../SqLiteDatabaseReaderBase.cs) (revision c6dd26c14af11a7e13f783f578466e46b463165a)
+++ Core/Common/src/Core.Common.IO/Readers/SqLiteDatabaseReaderBase.cs (.../SqLiteDatabaseReaderBase.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -84,8 +84,13 @@
///
public virtual void Dispose()
{
- Connection.Close();
- Connection.Dispose();
+ if (Connection != null)
+ {
+ Connection.Close();
+ Connection.Dispose();
+ }
+
+
}
///
Index: Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoDikeAssessmentSectionCommand.cs
===================================================================
diff -u -rb4ce929ce35e4770f3d8c12d14174de79cc5bee8 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoDikeAssessmentSectionCommand.cs (.../AddNewDemoDikeAssessmentSectionCommand.cs) (revision b4ce929ce35e4770f3d8c12d14174de79cc5bee8)
+++ Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoDikeAssessmentSectionCommand.cs (.../AddNewDemoDikeAssessmentSectionCommand.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -1,7 +1,7 @@
using System.Linq;
using Core.Common.Controls.Commands;
using Core.Common.Gui;
-
+using Ringtoets.HydraRing.Forms.PresentationObjects;
using Ringtoets.HydraRing.Plugin;
using Ringtoets.Integration.Data;
using Ringtoets.Integration.Forms.PresentationObjects;
@@ -70,15 +70,13 @@
private void InitializeDemoHydraulicBoundaryDatabase(DikeAssessmentSection demoAssessmentSection)
{
- var hydraulicBoundaryDatabase = demoAssessmentSection.HydraulicBoundaryDatabase;
-
using (var tempPath = new TemporaryImportFile("HRD_dutchcoastsouth.sqlite"))
{
- hydraulicBoundaryDatabase.FilePath = tempPath.FilePath;
- var hydraulicBoundaryDatabaseImporter = new HydraulicBoundaryLocationsImporter();
- hydraulicBoundaryDatabase.Version =
- hydraulicBoundaryDatabaseImporter.GetHydraulicBoundaryDatabaseVersion(tempPath.FilePath);
- hydraulicBoundaryDatabaseImporter.Import(hydraulicBoundaryDatabase.Locations, tempPath.FilePath);
+ using (var hydraulicBoundaryDatabaseImporter = new HydraulicBoundaryLocationsImporter())
+ {
+ hydraulicBoundaryDatabaseImporter.ValidateAndConnectTo(tempPath.FilePath);
+ hydraulicBoundaryDatabaseImporter.Import(new HydraulicBoundaryDatabaseContext(demoAssessmentSection), tempPath.FilePath);
+ }
}
}
Index: Demo/Ringtoets/src/Demo.Ringtoets/Demo.Ringtoets.csproj
===================================================================
diff -u -rad2d65c5904706727b1e19341a8b1162645c845a -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Demo/Ringtoets/src/Demo.Ringtoets/Demo.Ringtoets.csproj (.../Demo.Ringtoets.csproj) (revision ad2d65c5904706727b1e19341a8b1162645c845a)
+++ Demo/Ringtoets/src/Demo.Ringtoets/Demo.Ringtoets.csproj (.../Demo.Ringtoets.csproj) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -110,6 +110,10 @@
{70F8CC9C-5BC8-4FB2-B201-EAE7FA8088C2}
Ringtoets.HydraRing.Data
+
+ {EFB9B7E0-82A8-40CA-95C8-B56B4AC02294}
+ Ringtoets.HydraRing.Forms
+
{0A0B4576-1FD4-4836-880C-A7829ACB944A}
Ringtoets.HydraRing.Plugin
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Data/HydraulicBoundaryLocation.cs
===================================================================
diff -u -r16fef01c5d2d8ef8d15c652585efa85125ba7b25 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Data/HydraulicBoundaryLocation.cs (.../HydraulicBoundaryLocation.cs) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Data/HydraulicBoundaryLocation.cs (.../HydraulicBoundaryLocation.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -36,8 +36,13 @@
/// Name of the .
/// X coordinate of the .
/// Y coordinate of the .
+ /// Thrown when is null.
public HydraulicBoundaryLocation(long id, string name, double coordinateX, double coordinateY)
{
+ if (name == null)
+ {
+ throw new ArgumentNullException("name");
+ }
Id = id;
Name = name;
Location = new Point2D(coordinateX, coordinateY);
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Forms/PresentationObjects/HydraulicBoundaryDatabaseContext.cs
===================================================================
diff -u -racbd08302b69fc06e5cade26def0dea4d35e3b92 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Forms/PresentationObjects/HydraulicBoundaryDatabaseContext.cs (.../HydraulicBoundaryDatabaseContext.cs) (revision acbd08302b69fc06e5cade26def0dea4d35e3b92)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Forms/PresentationObjects/HydraulicBoundaryDatabaseContext.cs (.../HydraulicBoundaryDatabaseContext.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -31,45 +31,31 @@
///
public class HydraulicBoundaryDatabaseContext : Observable
{
- private readonly HydraulicBoundaryDatabase hydraulicBoundaryDatabase;
- private readonly AssessmentSectionBase baseNode;
+ private readonly AssessmentSectionBase parent;
///
/// Creates a new instance of .
///
- /// The instance wrapped by this context object.
- /// The which the belongs to.
- /// Thrown when is null.
- public HydraulicBoundaryDatabaseContext(HydraulicBoundaryDatabase hydraulicBoundaryDatabase, AssessmentSectionBase baseNode)
+ /// The which the belongs to.
+ /// Thrown when is null.
+ public HydraulicBoundaryDatabaseContext(AssessmentSectionBase parent)
{
- if (baseNode == null)
+ if (parent == null)
{
- throw new ArgumentNullException("baseNode", "Assessment section cannot be null.");
+ throw new ArgumentNullException("parent", "Assessment section cannot be null.");
}
- this.hydraulicBoundaryDatabase = hydraulicBoundaryDatabase;
- this.baseNode = baseNode;
+ this.parent = parent;
}
///
- /// Gets the which is wrapped by this context object.
- ///
- public HydraulicBoundaryDatabase BoundaryDatabase
- {
- get
- {
- return hydraulicBoundaryDatabase;
- }
- }
-
- ///
/// Gets the which this context object belongs to.
///
- public AssessmentSectionBase BaseNode
+ public AssessmentSectionBase Parent
{
get
{
- return baseNode;
+ return parent;
}
}
}
Fisheye: Tag 06f9145d8180df7fd26eac086a3f431c181e4d64 refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabase/GeneralEntity.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 06f9145d8180df7fd26eac086a3f431c181e4d64 refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabase/HrdLocationsEntity.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 06f9145d8180df7fd26eac086a3f431c181e4d64 refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabase/HydraulicBoundaryDatabaseQueryBuilder.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabaseContext/GeneralEntity.cs
===================================================================
diff -u
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabaseContext/GeneralEntity.cs (revision 0)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabaseContext/GeneralEntity.cs (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -0,0 +1,30 @@
+// 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.HydraulicBoundaryDatabaseContext
+{
+ internal class GeneralEntity
+ {
+ internal const string TableName = "General";
+ internal const string NameRegion = "NameRegion";
+ internal const string CreationDate = "CreationDate";
+ }
+}
\ No newline at end of file
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabaseContext/HrdLocationsEntity.cs
===================================================================
diff -u
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabaseContext/HrdLocationsEntity.cs (revision 0)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabaseContext/HrdLocationsEntity.cs (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -0,0 +1,33 @@
+// 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.HydraulicBoundaryDatabaseContext
+{
+ public static class HrdLocationsEntity
+ {
+ internal const string TableName = "HRDLocations";
+ internal const string HrdLocationId = "HRDLocationId";
+ internal const string LocationTypeId = "LocationTypeId";
+ internal const string Name = "Name";
+ internal const string XCoordinate = "XCoordinate";
+ internal const string YCoordinate = "YCoordinate";
+ }
+}
\ No newline at end of file
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabaseContext/HydraulicBoundaryDatabaseQueryBuilder.cs
===================================================================
diff -u
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabaseContext/HydraulicBoundaryDatabaseQueryBuilder.cs (revision 0)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabaseContext/HydraulicBoundaryDatabaseQueryBuilder.cs (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -0,0 +1,64 @@
+// 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.HydraulicBoundaryDatabaseContext
+{
+ public static class HydraulicBoundaryDatabaseQueryBuilder
+ {
+ public static string GetVersionQuery()
+ {
+ return string.Format(
+ "SELECT ({0} || {1}) as {2} FROM {3} LIMIT 0,1;",
+ GeneralEntity.NameRegion,
+ GeneralEntity.CreationDate,
+ HydraulicBoundaryDatabaseColumns.Version,
+ GeneralEntity.TableName
+ );
+ }
+
+ public static string GetLocationsCountQuery()
+ {
+ return string.Format(
+ "SELECT count({0}) as {1} FROM {2} WHERE {3} > 1 ;",
+ HrdLocationsEntity.HrdLocationId,
+ HydraulicBoundaryDatabaseColumns.LocationCount,
+ HrdLocationsEntity.TableName,
+ HrdLocationsEntity.LocationTypeId
+ );
+ }
+
+ public static string GetLocationsQuery()
+ {
+ return string.Format(
+ "SELECT {0} as {1}, " +
+ "{2} as {3}, " +
+ "{4} as {5}, " +
+ "{6} as {7} FROM " +
+ "{8} WHERE {9} > 1;",
+ HrdLocationsEntity.HrdLocationId, HydraulicBoundaryDatabaseColumns.LocationId,
+ HrdLocationsEntity.Name, HydraulicBoundaryDatabaseColumns.LocationName,
+ HrdLocationsEntity.XCoordinate, HydraulicBoundaryDatabaseColumns.LocationX,
+ HrdLocationsEntity.YCoordinate, HydraulicBoundaryDatabaseColumns.LocationY,
+ HrdLocationsEntity.TableName,
+ HrdLocationsEntity.LocationTypeId);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundarySqLiteDatabaseReader.cs
===================================================================
diff -u -r16fef01c5d2d8ef8d15c652585efa85125ba7b25 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundarySqLiteDatabaseReader.cs (.../HydraulicBoundarySqLiteDatabaseReader.cs) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundarySqLiteDatabaseReader.cs (.../HydraulicBoundarySqLiteDatabaseReader.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -26,7 +26,7 @@
using Core.Common.IO.Readers;
using Core.Common.Utils.Builders;
using Ringtoets.HydraRing.Data;
-using Ringtoets.HydraRing.IO.HydraulicBoundaryDatabase;
+using Ringtoets.HydraRing.IO.HydraulicBoundaryDatabaseContext;
using Ringtoets.HydraRing.IO.Properties;
namespace Ringtoets.HydraRing.IO
@@ -49,25 +49,11 @@
///
/// - The contains invalid characters.
/// - No file could be found at .
- /// - Preparing the database queries failed.
///
///
- public HydraulicBoundarySqLiteDatabaseReader(string databaseFilePath) : base(databaseFilePath)
- {
- InitializeReader();
- }
+ public HydraulicBoundarySqLiteDatabaseReader(string databaseFilePath) : base(databaseFilePath) {}
///
- /// Gets the total number of locations that can be read from the database.
- ///
- public int Count { get; private set; }
-
- ///
- /// Gets the version from the database.
- ///
- public string Version { get; private set; }
-
- ///
/// Gets a value indicating whether or not more hydraulic boundary locations can
/// be read using the .
///
@@ -80,6 +66,17 @@
/// database or null if no data is available.
/// Thrown when the database returned incorrect values for
/// required properties.
+ public void PrepareReadLocation()
+ {
+ var locationsQuery = HydraulicBoundaryDatabaseQueryBuilder.GetLocationsQuery();
+
+ CreateDataReader(locationsQuery, new SQLiteParameter
+ {
+ DbType = DbType.String
+ });
+ MoveNext();
+ }
+
public HydraulicBoundaryLocation ReadLocation()
{
if (!HasNext)
@@ -99,12 +96,67 @@
}
}
- public override void Dispose()
+ ///
+ /// Gets the database version from the metadata table.
+ ///
+ ///
+ public string GetVersion()
{
- if (dataReader != null)
+ var versionQuery = HydraulicBoundaryDatabaseQueryBuilder.GetVersionQuery();
+ var sqliteParameter = new SQLiteParameter
{
- dataReader.Dispose();
+ DbType = DbType.String
+ };
+ CreateDataReader(versionQuery, sqliteParameter);
+
+ if (!dataReader.Read())
+ {
+ return "";
}
+ try
+ {
+ return Read(HydraulicBoundaryDatabaseColumns.Version);
+ }
+ catch (InvalidCastException e)
+ {
+ var message = new FileReaderErrorMessageBuilder(Path).
+ Build(Resources.HydraulicBoundaryDatabaseReader_Critical_Unexpected_value_on_column);
+ throw new LineParseException(message, e);
+ }
+ }
+
+ ///
+ /// Gets the amount of locations that can be read from the database.
+ ///
+ ///
+ public int GetLocationCount()
+ {
+ var locationCountQuery = HydraulicBoundaryDatabaseQueryBuilder.GetLocationsCountQuery();
+ var sqliteParameter = new SQLiteParameter
+ {
+ DbType = DbType.String
+ };
+ CreateDataReader(locationCountQuery, sqliteParameter);
+
+ if (!dataReader.Read())
+ {
+ return 0;
+ }
+ try
+ {
+ return (int) Read(HydraulicBoundaryDatabaseColumns.LocationCount);
+ }
+ catch (InvalidCastException e)
+ {
+ var message = new FileReaderErrorMessageBuilder(Path).
+ Build(Resources.HydraulicBoundaryDatabaseReader_Critical_Unexpected_value_on_column);
+ throw new LineParseException(message, e);
+ }
+ }
+
+ public override void Dispose()
+ {
+ CloseDataReader();
base.Dispose();
}
@@ -154,31 +206,6 @@
}
///
- /// Prepares a new data reader with queries for obtaining the locations and updates the reader
- /// so that it points to the first row of the result set.
- ///
- private void InitializeReader()
- {
- PrepareReader();
- MoveNext();
- }
-
- ///
- /// Prepares the queries required for obtaining locations from the database.
- ///
- private void PrepareReader()
- {
- var versionQuery = HydraulicBoundaryDatabaseQueryBuilder.GetVersionQuery();
- var countQuery = HydraulicBoundaryDatabaseQueryBuilder.GetLocationsCountQuery();
- var locationsQuery = HydraulicBoundaryDatabaseQueryBuilder.GetLocationsQuery();
-
- CreateDataReader(string.Join(" ", versionQuery, countQuery, locationsQuery), new SQLiteParameter
- {
- DbType = DbType.String
- });
- }
-
- ///
/// Creates a new data reader to use in this class.
///
/// Thrown when
@@ -189,6 +216,7 @@
///
private void CreateDataReader(string queryString, params SQLiteParameter[] parameters)
{
+ CloseDataReader();
using (var query = new SQLiteCommand(Connection)
{
CommandText = queryString
@@ -199,8 +227,6 @@
try
{
dataReader = query.ExecuteReader();
- GetVersion();
- GetCount();
}
catch (SQLiteException exception)
{
@@ -211,26 +237,13 @@
}
}
- ///
- /// Gets the database version from the metadata table.
- ///
- private void GetVersion()
+ private void CloseDataReader()
{
- if (dataReader.Read())
+ if (dataReader != null)
{
- Version = Read(HydraulicBoundaryDatabaseColumns.Version);
+ dataReader.Dispose();
+
}
- dataReader.NextResult();
}
-
- ///
- /// Gets the amount of locations that can be read from the database.
- ///
- private void GetCount()
- {
- dataReader.Read();
- Count = (int) Read(HydraulicBoundaryDatabaseColumns.LocationCount);
- dataReader.NextResult();
- }
}
}
\ No newline at end of file
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/Ringtoets.HydraRing.IO.csproj
===================================================================
diff -u -r16fef01c5d2d8ef8d15c652585efa85125ba7b25 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/Ringtoets.HydraRing.IO.csproj (.../Ringtoets.HydraRing.IO.csproj) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/Ringtoets.HydraRing.IO.csproj (.../Ringtoets.HydraRing.IO.csproj) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -1,6 +1,5 @@
-
Debug
@@ -47,11 +46,11 @@
Properties\GlobalAssembly.cs
-
-
+
+
-
+
@@ -67,6 +66,11 @@
+
+ {3bbfd65b-b277-4e50-ae6d-bd24c3434609}
+ Core.Common.Base
+ False
+
{E344867E-9AC9-44C8-88A5-8185681679A9}
Core.Common.IO
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Plugin/HydraulicBoundaryLocationsImporter.cs
===================================================================
diff -u -r16fef01c5d2d8ef8d15c652585efa85125ba7b25 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Plugin/HydraulicBoundaryLocationsImporter.cs (.../HydraulicBoundaryLocationsImporter.cs) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Plugin/HydraulicBoundaryLocationsImporter.cs (.../HydraulicBoundaryLocationsImporter.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -21,14 +21,14 @@
using System;
using System.Collections.Generic;
-using System.Collections.ObjectModel;
using System.Drawing;
using Core.Common.Base.IO;
using Core.Common.IO.Exceptions;
-using Core.Common.IO.Readers;
using log4net;
using Ringtoets.HydraRing.Data;
+using Ringtoets.HydraRing.Forms.PresentationObjects;
using Ringtoets.HydraRing.IO;
+using Ringtoets.Integration.Data;
using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
using RingtoetsHydraRingFormsResources = Ringtoets.HydraRing.Forms.Properties.Resources;
using ApplicationResources = Ringtoets.HydraRing.Plugin.Properties.Resources;
@@ -40,10 +40,12 @@
/// Imports locations read from an Hydraulic boundary .sqlite file (SqlLite database file) to a
/// collection of .
///
- public class HydraulicBoundaryLocationsImporter : FileImporterBase
+ public class HydraulicBoundaryLocationsImporter : FileImporterBase, IDisposable
{
private readonly ILog log = LogManager.GetLogger(typeof(HydraulicBoundaryLocationsImporter));
+ private HydraulicBoundarySqLiteDatabaseReader hydraulicBoundaryDatabaseReader;
+
public override string Name
{
get
@@ -86,22 +88,36 @@
public override ProgressChangedDelegate ProgressChanged { protected get; set; }
- public string GetHydraulicBoundaryDatabaseVersion(string filePath)
+ ///
+ /// Validates the file and opens a connection.
+ ///
+ /// The path to the file to read.
+ /// Thrown when the given file at cannot be read.
+ public void ValidateAndConnectTo(string filePath)
{
- using (var hydraulicBoundaryDatabaseReader = new HydraulicBoundarySqLiteDatabaseReader(filePath))
- {
- return hydraulicBoundaryDatabaseReader.Version;
- }
+ hydraulicBoundaryDatabaseReader = new HydraulicBoundarySqLiteDatabaseReader(filePath);
}
- public override bool Import(object targetItem, string filePath)
+ ///
+ /// Gets the version of the database.
+ ///
+ /// The database version.
+ public string GetHydraulicBoundaryDatabaseVersion()
{
- var importResult = ReadHydraulicBoundaryLocations(filePath);
+ return hydraulicBoundaryDatabaseReader.GetVersion();
+ }
- if (importResult.CriticalErrorOccurred)
+ public override bool Import(object targetItem, string filePath)
+ {
+ if (hydraulicBoundaryDatabaseReader == null)
{
- return false;
+ throw new InvalidOperationException(ApplicationResources.HydraulicBoundaryLocationsImporter_Import_The_file_is_not_opened);
}
+
+ var importTarget = (HydraulicBoundaryDatabaseContext) targetItem;
+
+ var importResult = ReadHydraulicBoundaryLocations(filePath);
+
if (ImportIsCancelled)
{
log.Info(ApplicationResources.HydraulicBoundaryLocationsImporter_Import_cancelled);
@@ -110,27 +126,38 @@
return false;
}
- AddImportedDataToModel(targetItem, importResult);
+ if (importResult == null)
+ {
+ return false;
+ }
+
+ AddImportedDataToModel(importTarget.Parent, importResult);
log.Info(ApplicationResources.HydraulicBoundaryLocationsImporter_Import_Import_successful);
return true;
}
- private ReadResult ReadHydraulicBoundaryLocations(string path)
+ public void Dispose()
{
+ if (hydraulicBoundaryDatabaseReader != null)
+ {
+ hydraulicBoundaryDatabaseReader.Dispose();
+ hydraulicBoundaryDatabaseReader = null;
+ }
+ }
+
+ private HydraulicBoundaryDatabase ReadHydraulicBoundaryLocations(string path)
+ {
NotifyProgress(ApplicationResources.HydraulicBoundaryLocationsImporter_ReadHydraulicBoundaryLocations, 1, 1);
try
{
- using (var hydraulicBoundaryDatabaseReader = new HydraulicBoundarySqLiteDatabaseReader(path))
- {
- return GetHydraulicBoundaryLocationReadResult(path, hydraulicBoundaryDatabaseReader);
- }
+ return GetHydraulicBoundaryDatabase(path);
}
catch (LineParseException e)
{
HandleException(e);
}
- return new ReadResult(true);
+ return null;
}
private void HandleException(Exception e)
@@ -139,49 +166,42 @@
log.Error(message);
}
- private ReadResult GetHydraulicBoundaryLocationReadResult(string path,
- HydraulicBoundarySqLiteDatabaseReader hydraulicBoundarySqLiteDatabaseReader)
+ private HydraulicBoundaryDatabase GetHydraulicBoundaryDatabase(string path)
{
- var totalNumberOfSteps = hydraulicBoundarySqLiteDatabaseReader.Count;
+ var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase()
+ {
+ FilePath = path,
+ Version = hydraulicBoundaryDatabaseReader.GetVersion()
+ };
+ var totalNumberOfSteps = hydraulicBoundaryDatabaseReader.GetLocationCount();
var currentStep = 1;
- var locations = new Collection();
- while (hydraulicBoundarySqLiteDatabaseReader.HasNext)
+ hydraulicBoundaryDatabaseReader.PrepareReadLocation();
+ while (hydraulicBoundaryDatabaseReader.HasNext)
{
if (ImportIsCancelled)
{
- return new ReadResult(false);
+ return null;
}
NotifyProgress(ApplicationResources.HydraulicBoundaryLocationsImporter_GetHydraulicBoundaryLocationReadResult, currentStep++, totalNumberOfSteps);
try
{
- locations.Add(hydraulicBoundarySqLiteDatabaseReader.ReadLocation());
+ hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryDatabaseReader.ReadLocation());
}
catch (CriticalFileReadException e)
{
var message = string.Format(ApplicationResources.HydraulicBoundaryLocationsImporter_CriticalErrorMessage_0_File_Skipped, path);
log.Error(message, e);
- return new ReadResult(true);
+ return null;
}
}
- return new ReadResult(false)
- {
- ImportedItems = locations
- };
+
+ return hydraulicBoundaryDatabase;
}
- private void AddImportedDataToModel(object target, ReadResult imported)
+ private void AddImportedDataToModel(AssessmentSectionBase assessmentSection, HydraulicBoundaryDatabase importedData)
{
- var targetCollection = (ICollection) target;
-
- int totalCount = imported.ImportedItems.Count;
- NotifyProgress(ApplicationResources.HydraulicBoundaryLocationsImporter_Adding_imported_data_to_model,
- totalCount, totalCount);
-
- foreach (var item in imported.ImportedItems)
- {
- targetCollection.Add(item);
- }
+ assessmentSection.HydraulicBoundaryDatabase = importedData;
}
}
}
\ No newline at end of file
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Plugin/Properties/Resources.Designer.cs
===================================================================
diff -u -r16fef01c5d2d8ef8d15c652585efa85125ba7b25 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -61,15 +61,6 @@
}
///
- /// Looks up a localized string similar to Geïmporteerde hydraulische randvoorwaarde locaties toevoegen aan traject..
- ///
- public static string HydraulicBoundaryLocationsImporter_Adding_imported_data_to_model {
- get {
- return ResourceManager.GetString("HydraulicBoundaryLocationsImporter_Adding_imported_data_to_model", resourceCulture);
- }
- }
-
- ///
/// Looks up a localized string similar to {0} Het bestand wordt overgeslagen..
///
public static string HydraulicBoundaryLocationsImporter_CriticalErrorMessage_0_File_Skipped {
@@ -79,7 +70,7 @@
}
///
- /// Looks up a localized string similar to Inlezen van de locaties uit de hydraulische randvoorwaarden database.
+ /// Looks up a localized string similar to Inlezen van de locaties uit de hydraulische randvoorwaarden database..
///
public static string HydraulicBoundaryLocationsImporter_GetHydraulicBoundaryLocationReadResult {
get {
@@ -88,7 +79,7 @@
}
///
- /// Looks up a localized string similar to Locaties van hydraulische randvoorwaarden importeren is afgebroken. Er is geen data ingelezen..
+ /// Looks up a localized string similar to Het importeren van hydraulische randvoorwaarden locaties is afgebroken. Er is geen data ingelezen..
///
public static string HydraulicBoundaryLocationsImporter_Import_cancelled {
get {
@@ -97,7 +88,7 @@
}
///
- /// Looks up a localized string similar to Locaties uit de hydraulische randvoorwaarden ingelezen.
+ /// Looks up a localized string similar to De hydraulische randvoorwaarden locaties zijn ingelezen..
///
public static string HydraulicBoundaryLocationsImporter_Import_Import_successful {
get {
@@ -106,8 +97,17 @@
}
///
- /// Looks up a localized string similar to Inlezen van de de hydraulische randvoorwaarden database.
+ /// Looks up a localized string similar to Er is nog geen bestand geopend..
///
+ public static string HydraulicBoundaryLocationsImporter_Import_The_file_is_not_opened {
+ get {
+ return ResourceManager.GetString("HydraulicBoundaryLocationsImporter_Import_The_file_is_not_opened", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Inlezen van de de hydraulische randvoorwaarden database..
+ ///
public static string HydraulicBoundaryLocationsImporter_ReadHydraulicBoundaryLocations {
get {
return ResourceManager.GetString("HydraulicBoundaryLocationsImporter_ReadHydraulicBoundaryLocations", resourceCulture);
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Plugin/Properties/Resources.resx
===================================================================
diff -u -r16fef01c5d2d8ef8d15c652585efa85125ba7b25 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Plugin/Properties/Resources.resx (.../Resources.resx) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Plugin/Properties/Resources.resx (.../Resources.resx) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -117,22 +117,22 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- Geïmporteerde hydraulische randvoorwaarde locaties toevoegen aan traject.
-
{0} Het bestand wordt overgeslagen.
- Locaties van hydraulische randvoorwaarden importeren is afgebroken. Er is geen data ingelezen.
+ Het importeren van hydraulische randvoorwaarden locaties is afgebroken. Er is geen data ingelezen.
- Locaties uit de hydraulische randvoorwaarden ingelezen
+ De hydraulische randvoorwaarden locaties zijn ingelezen.
- Inlezen van de de hydraulische randvoorwaarden database
+ Inlezen van de de hydraulische randvoorwaarden database.
- Inlezen van de locaties uit de hydraulische randvoorwaarden database
+ Inlezen van de locaties uit de hydraulische randvoorwaarden database.
+
+ Er is nog geen bestand geopend.
+
\ No newline at end of file
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Data.Test/HydraulicBoundaryLocationTest.cs
===================================================================
diff -u -r7235aeaea6e256141b54459aa33da203e84f280b -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Data.Test/HydraulicBoundaryLocationTest.cs (.../HydraulicBoundaryLocationTest.cs) (revision 7235aeaea6e256141b54459aa33da203e84f280b)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Data.Test/HydraulicBoundaryLocationTest.cs (.../HydraulicBoundaryLocationTest.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -19,6 +19,7 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
using System.ComponentModel;
using Core.Common.Base.Geometry;
using Core.Common.Gui.Converters;
@@ -32,18 +33,13 @@
public class HydraulicBoundaryLocationTest
{
[Test]
- public void Constructor_NullName_DoesNotThrowException()
+ public void Constructor_NullName_ThrowsArgumentNullException()
{
- // Setup
- long id = 0L;
- double x = 1.0;
- double y = 1.0;
-
// Call
- TestDelegate test = () => new HydraulicBoundaryLocation(id, null, x, y);
+ TestDelegate test = () => new HydraulicBoundaryLocation(0L, null, 0.0, 0.0);
// Assert
- Assert.DoesNotThrow(test);
+ Assert.Throws(test);
}
[Test]
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Forms.Test/PresentationObjects/HydraulicBoundaryDatabaseContextTest.cs
===================================================================
diff -u -rbb0c146c092dadc5f82f0fad45ed92658d436d5c -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Forms.Test/PresentationObjects/HydraulicBoundaryDatabaseContextTest.cs (.../HydraulicBoundaryDatabaseContextTest.cs) (revision bb0c146c092dadc5f82f0fad45ed92658d436d5c)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Forms.Test/PresentationObjects/HydraulicBoundaryDatabaseContextTest.cs (.../HydraulicBoundaryDatabaseContextTest.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -36,29 +36,23 @@
public void DefaultConstructor_ExpectedValues()
{
// Setup
- var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
-
var mocks = new MockRepository();
var assessmentSectionBaseMock = mocks.StrictMock();
mocks.ReplayAll();
// Call
- var pressentationObject = new HydraulicBoundaryDatabaseContext(hydraulicBoundaryDatabase, assessmentSectionBaseMock);
+ var pressentationObject = new HydraulicBoundaryDatabaseContext(assessmentSectionBaseMock);
// Assert
Assert.IsInstanceOf(pressentationObject);
- Assert.AreSame(hydraulicBoundaryDatabase, pressentationObject.BoundaryDatabase);
- Assert.AreSame(assessmentSectionBaseMock, pressentationObject.BaseNode);
+ Assert.AreSame(assessmentSectionBaseMock, pressentationObject.Parent);
}
[Test]
public void Constructor_AssesmentSectionBaseIsNull_ThrowArgumentNullException()
{
- // Setup
- var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
-
// Call
- TestDelegate call = () => new HydraulicBoundaryDatabaseContext(hydraulicBoundaryDatabase, null);
+ TestDelegate call = () => new HydraulicBoundaryDatabaseContext(null);
var exception = Assert.Throws(call);
string customMessage = exception.Message.Split(new[]
@@ -76,11 +70,10 @@
var observer = mocks.StrictMock();
observer.Expect(o => o.UpdateObserver());
- var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
var assessmentSectionBaseMock = mocks.StrictMock();
mocks.ReplayAll();
- var presentationObject = new HydraulicBoundaryDatabaseContext(hydraulicBoundaryDatabase, assessmentSectionBaseMock);
+ var presentationObject = new HydraulicBoundaryDatabaseContext(assessmentSectionBaseMock);
presentationObject.Attach(observer);
// Call
@@ -97,11 +90,10 @@
var mocks = new MockRepository();
var observer = mocks.StrictMock();
- var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
var assessmentSectionBaseMock = mocks.StrictMock();
mocks.ReplayAll();
- var presentationObject = new HydraulicBoundaryDatabaseContext(hydraulicBoundaryDatabase, assessmentSectionBaseMock);
+ var presentationObject = new HydraulicBoundaryDatabaseContext(assessmentSectionBaseMock);
presentationObject.Attach(observer);
presentationObject.Detach(observer);
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Forms.Test/PresentationObjects/HydraulicBoundaryLocationPropertiesTest.cs
===================================================================
diff -u -r670a44402abe4f0a366f60661c13ec194ffe01a7 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Forms.Test/PresentationObjects/HydraulicBoundaryLocationPropertiesTest.cs (.../HydraulicBoundaryLocationPropertiesTest.cs) (revision 670a44402abe4f0a366f60661c13ec194ffe01a7)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Forms.Test/PresentationObjects/HydraulicBoundaryLocationPropertiesTest.cs (.../HydraulicBoundaryLocationPropertiesTest.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -85,7 +85,6 @@
}
[Test]
- [TestCase(null)]
[TestCase("")]
[TestCase("some name")]
public void ToString_WithName_ReturnsName(string name)
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/HydraulicBoundaryDatabaseReaderTest.cs
===================================================================
diff -u -r16fef01c5d2d8ef8d15c652585efa85125ba7b25 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/HydraulicBoundaryDatabaseReaderTest.cs (.../HydraulicBoundaryDatabaseReaderTest.cs) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/HydraulicBoundaryDatabaseReaderTest.cs (.../HydraulicBoundaryDatabaseReaderTest.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -71,20 +71,21 @@
}
[Test]
- public void Constructor_IncorrectFormatFile_ThrowsCriticalFileReadException()
+ public void GetVersion_IncorrectFormatFile_ThrowsCriticalFileReadException()
{
// Setup
var dbFile = Path.Combine(testDataPath, "empty.sqlite");
var expectedMessage = new FileReaderErrorMessageBuilder(dbFile).Build(Resources.Error_HydraulicBoundaryLocation_read_from_database);
// Precondition
Assert.IsTrue(TestHelper.CanOpenFileForWrite(dbFile), "Precondition: file can be opened for edits.");
+ HydraulicBoundarySqLiteDatabaseReader hydraulicBoundarySqLiteDatabaseReader = new HydraulicBoundarySqLiteDatabaseReader(dbFile);
// Call
- TestDelegate test = () => new HydraulicBoundarySqLiteDatabaseReader(dbFile).Dispose();
+ TestDelegate test = () => { hydraulicBoundarySqLiteDatabaseReader.GetVersion(); };
- // Assert
var exception = Assert.Throws(test);
+
Assert.AreEqual(expectedMessage, exception.Message);
Assert.IsTrue(TestHelper.CanOpenFileForWrite(dbFile));
}
@@ -100,9 +101,9 @@
// Call
using (HydraulicBoundarySqLiteDatabaseReader hydraulicBoundarySqLiteDatabaseReader = new HydraulicBoundarySqLiteDatabaseReader(dbFile))
{
- Assert.AreEqual(version, hydraulicBoundarySqLiteDatabaseReader.Version);
- Assert.AreEqual(nrOfLocations, hydraulicBoundarySqLiteDatabaseReader.Count);
- Assert.IsTrue(hydraulicBoundarySqLiteDatabaseReader.HasNext);
+ Assert.AreEqual(version, hydraulicBoundarySqLiteDatabaseReader.GetVersion());
+ Assert.AreEqual(nrOfLocations, hydraulicBoundarySqLiteDatabaseReader.GetLocationCount());
+ Assert.IsFalse(hydraulicBoundarySqLiteDatabaseReader.HasNext);
}
Assert.IsTrue(TestHelper.CanOpenFileForWrite(dbFile));
}
@@ -120,6 +121,7 @@
// Call
using (HydraulicBoundarySqLiteDatabaseReader hydraulicBoundarySqLiteDatabaseReader = new HydraulicBoundarySqLiteDatabaseReader(dbFile))
{
+ hydraulicBoundarySqLiteDatabaseReader.PrepareReadLocation();
TestDelegate test = () => hydraulicBoundarySqLiteDatabaseReader.ReadLocation();
// Assert
@@ -139,6 +141,7 @@
// Call
using (HydraulicBoundarySqLiteDatabaseReader hydraulicBoundarySqLiteDatabaseReader = new HydraulicBoundarySqLiteDatabaseReader(dbFile))
{
+ hydraulicBoundarySqLiteDatabaseReader.PrepareReadLocation();
HydraulicBoundaryLocation location = hydraulicBoundarySqLiteDatabaseReader.ReadLocation();
// Assert
@@ -159,6 +162,7 @@
// Call
using (HydraulicBoundarySqLiteDatabaseReader hydraulicBoundarySqLiteDatabaseReader = new HydraulicBoundarySqLiteDatabaseReader(dbFile))
{
+ hydraulicBoundarySqLiteDatabaseReader.PrepareReadLocation();
for (int i = 0; i < nrOfLocations; i++)
{
boundaryLocations.Add(hydraulicBoundarySqLiteDatabaseReader.ReadLocation());
@@ -228,6 +232,7 @@
try
{
hydraulicBoundarySqLiteDatabaseReader = new HydraulicBoundarySqLiteDatabaseReader(dbFile);
+ hydraulicBoundarySqLiteDatabaseReader.PrepareReadLocation();
boundaryLocation = hydraulicBoundarySqLiteDatabaseReader.ReadLocation();
}
finally
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/Ringtoets.HydraRing.IO.Test.csproj
===================================================================
diff -u -r16fef01c5d2d8ef8d15c652585efa85125ba7b25 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/Ringtoets.HydraRing.IO.Test.csproj (.../Ringtoets.HydraRing.IO.Test.csproj) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/Ringtoets.HydraRing.IO.Test.csproj (.../Ringtoets.HydraRing.IO.Test.csproj) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -1,6 +1,5 @@
-
Debug
x86
@@ -85,9 +84,7 @@
Ringtoets.HydraRing.IO
-
-
-
+
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Plugin.Test/HydraulicBoundaryLocationsImporterTest.cs
===================================================================
diff -u -r16fef01c5d2d8ef8d15c652585efa85125ba7b25 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Plugin.Test/HydraulicBoundaryLocationsImporterTest.cs (.../HydraulicBoundaryLocationsImporterTest.cs) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Plugin.Test/HydraulicBoundaryLocationsImporterTest.cs (.../HydraulicBoundaryLocationsImporterTest.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -21,17 +21,17 @@
using System;
using System.Collections.Generic;
-using System.Data.SQLite;
using System.IO;
using System.Linq;
using Core.Common.Base;
using Core.Common.Base.IO;
using Core.Common.IO.Exceptions;
using Core.Common.TestUtil;
-using Core.Common.Utils.Builders;
using NUnit.Framework;
using Rhino.Mocks;
using Ringtoets.HydraRing.Data;
+using Ringtoets.HydraRing.Forms.PresentationObjects;
+using Ringtoets.Integration.Data;
using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
using RingtoetsHydraRingFormsResources = Ringtoets.HydraRing.Forms.Properties.Resources;
using RingtoetsHydraRingPluginResources = Ringtoets.HydraRing.Plugin.Properties.Resources;
@@ -46,21 +46,30 @@
private readonly string testDataPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.IO, "HydraulicBoundaryLocationReader");
private int progress;
+ private HydraulicBoundaryLocationsImporter importer;
+
[SetUp]
public void SetUp()
{
progress = 0;
+
+ importer = new HydraulicBoundaryLocationsImporter();
}
+ [TearDown]
+ public void TearDown()
+ {
+ importer.Dispose();
+ }
+
[Test]
public void DefaultConstructor_ExpectedValues()
{
// Setup
var expectedFileFilter = string.Format("{0} (*.sqlite)|*.sqlite", RingtoetsHydraRingFormsResources.SelectHydraulicBoundaryDatabaseFile_FilterName);
var expectedDisplayName = "Locaties van de hydraulische randvoorwaarden";
- // Call
- var importer = new HydraulicBoundaryLocationsImporter();
+ // Call is done in SetUp
// Assert
Assert.IsInstanceOf(importer);
@@ -73,31 +82,42 @@
}
[Test]
- public void GetHydraulicBoundaryDatabaseVersion_NonExistingFile_ThrowsCriticalFileReadException()
+ public void ValidateAndConnectTo_ExistingFile_DoesNotThrowException()
{
// Setup
+ string validFilePath = Path.Combine(testDataPath, "complete.sqlite");
+
+ // Call
+ TestDelegate test = () => importer.ValidateAndConnectTo(validFilePath);
+
+ // Assert
+ Assert.DoesNotThrow(test);
+ }
+
+ [Test]
+ public void ValidateAndConnectTo_NonExistingFile_ThrowsCriticalFileReadException()
+ {
+ // Setup
string filePath = Path.Combine(testDataPath, "nonexisting.sqlite");
- var importer = new HydraulicBoundaryLocationsImporter();
var expectedExceptionMessage = String.Format("Fout bij het lezen van bestand '{0}': Het bestand bestaat niet.", filePath);
// Call
- TestDelegate test = () => importer.GetHydraulicBoundaryDatabaseVersion(filePath);
+ TestDelegate test = () => importer.ValidateAndConnectTo(filePath);
// Assert
CriticalFileReadException exception = Assert.Throws(test);
Assert.AreEqual(expectedExceptionMessage, exception.Message);
}
[Test]
- public void GetHydraulicBoundaryDatabaseVersion_InvalidFile_ThrowsCriticalFileReadException()
+ public void ValidateAndConnectTo_InvalidFile_ThrowsCriticalFileReadException()
{
// Setup
string filePath = Path.Combine(testDataPath, "/");
- var importer = new HydraulicBoundaryLocationsImporter();
var expectedExceptionMessage = String.Format("Fout bij het lezen van bestand '{0}': Bestandspad mag niet naar een map verwijzen.", filePath);
// Call
- TestDelegate test = () => importer.GetHydraulicBoundaryDatabaseVersion(filePath);
+ TestDelegate test = () => importer.ValidateAndConnectTo(filePath);
// Assert
CriticalFileReadException exception = Assert.Throws(test);
@@ -110,59 +130,54 @@
{
// Setup
string validFilePath = Path.Combine(testDataPath, "complete.sqlite");
- var importer = new HydraulicBoundaryLocationsImporter();
+ importer.ValidateAndConnectTo(validFilePath);
// Call
- string version = importer.GetHydraulicBoundaryDatabaseVersion(validFilePath);
+ string version = importer.GetHydraulicBoundaryDatabaseVersion();
// Assert
Assert.IsNotNullOrEmpty(version);
}
[Test]
- [TestCase("/", "Fout bij het lezen van bestand '{0}': Bestandspad mag niet naar een map verwijzen.")]
- [TestCase("nonexisting.sqlite", "Fout bij het lezen van bestand '{0}': Het bestand bestaat niet.")]
- public void Import_FromNonExistingFileOrInvalidFile_ThrowsCriticalFileReadException(string filename, string exceptionMessage)
+ public void Import_ConnectionNotOpened_ThrowsInValidOperationException()
{
// Setup
- string validFilePath = Path.Combine(testDataPath, filename);
- var expectedMessage = string.Format(exceptionMessage, validFilePath);
+ string validFilePath = Path.Combine(testDataPath, "complete.sqlite");
var mocks = new MockRepository();
- var observer = mocks.StrictMock();
+ var assessmentSection = mocks.StrictMock();
mocks.ReplayAll();
- var observableList = new ObservableList();
- observableList.Attach(observer);
- var importer = new HydraulicBoundaryLocationsImporter
- {
- ProgressChanged = IncrementProgress
- };
+ var context = new HydraulicBoundaryDatabaseContext(assessmentSection);
- // Precondition
- CollectionAssert.IsEmpty(observableList);
+ var expectedMessage = "Er is nog geen bestand geopend.";
// Call
- TestDelegate test = () => importer.Import(observableList, validFilePath);
+ TestDelegate call = () => importer.Import(context, validFilePath);
// Assert
- CriticalFileReadException exception = Assert.Throws(test);
+ var exception = Assert.Throws(call);
Assert.AreEqual(expectedMessage, exception.Message);
- CollectionAssert.IsEmpty(observableList);
- Assert.AreEqual(1, progress);
-
- mocks.VerifyAll(); // 'observer' should not be notified
}
[Test]
public void Import_ImportingToValidTargetWithValidFile_ImportHydraulicBoundaryLocationsToCollection()
{
// Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.StrictMock();
+ mocks.ReplayAll();
+
+ var importTarget = new HydraulicBoundaryDatabaseContext(assessmentSection);
+
string validFilePath = Path.Combine(testDataPath, "complete.sqlite");
- var importer = new HydraulicBoundaryLocationsImporter();
- var importTarget = new List();
+
+ // Precondition
Assert.IsTrue(File.Exists(validFilePath), string.Format("Precodition failed. File does not exist: {0}", validFilePath));
+ importer.ValidateAndConnectTo(validFilePath);
+
// Call
var importResult = false;
Action call = () => importResult = importer.Import(importTarget, validFilePath);
@@ -174,9 +189,10 @@
StringAssert.EndsWith(RingtoetsHydraRingPluginResources.HydraulicBoundaryLocationsImporter_Import_Import_successful, messageArray[0]);
});
Assert.IsTrue(importResult);
- Assert.AreEqual(18, importTarget.Count);
- CollectionAssert.AllItemsAreNotNull(importTarget);
- CollectionAssert.AllItemsAreUnique(importTarget);
+ ICollection importedLocations = importTarget.Parent.HydraulicBoundaryDatabase.Locations;
+ Assert.AreEqual(18, importedLocations.Count);
+ CollectionAssert.AllItemsAreNotNull(importedLocations);
+ CollectionAssert.AllItemsAreUnique(importedLocations);
}
[Test]
@@ -187,30 +203,30 @@
var mocks = new MockRepository();
var observer = mocks.StrictMock();
+ var assessmentSection = mocks.StrictMock();
mocks.ReplayAll();
- var observableList = new ObservableList();
- observableList.Attach(observer);
+ var importTarget = new HydraulicBoundaryDatabaseContext( assessmentSection);
+ importTarget.Attach(observer);
- var importer = new HydraulicBoundaryLocationsImporter
- {
- ProgressChanged = IncrementProgress
- };
+ importer.ProgressChanged = IncrementProgress;
// Precondition
- CollectionAssert.IsEmpty(observableList);
+ Assert.IsNull(importTarget.Parent.HydraulicBoundaryDatabase);
Assert.IsTrue(File.Exists(validFilePath), string.Format("Precodition failed. File does not exist: {0}", validFilePath));
+ importer.ValidateAndConnectTo(validFilePath);
+
importer.Cancel();
var importResult = true;
// Call
- Action call = () => importResult = importer.Import(observableList, validFilePath);
+ Action call = () => importResult = importer.Import(importTarget, validFilePath);
// Assert
- TestHelper.AssertLogMessageIsGenerated(call, "Locaties van hydraulische randvoorwaarden importeren is afgebroken. Er is geen data ingelezen.", 1);
+ TestHelper.AssertLogMessageIsGenerated(call, "Het importeren van hydraulische randvoorwaarden locaties is afgebroken. Er is geen data ingelezen.", 1);
Assert.IsFalse(importResult);
- CollectionAssert.IsEmpty(observableList);
+ Assert.IsNull(importTarget.Parent.HydraulicBoundaryDatabase);
Assert.AreEqual(1, progress);
mocks.VerifyAll(); // 'observer' should not be notified
@@ -224,97 +240,66 @@
var mocks = new MockRepository();
var observer = mocks.StrictMock();
+ var assessmentSection = mocks.StrictMock();
observer.Expect(o => o.UpdateObserver());
mocks.ReplayAll();
- var observableList = new ObservableList();
- observableList.Attach(observer);
+ var importTarget = new HydraulicBoundaryDatabaseContext(assessmentSection);
+ importTarget.Attach(observer);
- var importer = new HydraulicBoundaryLocationsImporter
- {
- ProgressChanged = IncrementProgress
- };
+ importer.ProgressChanged = IncrementProgress;
// Precondition
- CollectionAssert.IsEmpty(observableList);
+ Assert.IsNull(importTarget.Parent.HydraulicBoundaryDatabase);
Assert.IsTrue(File.Exists(validFilePath));
+ importer.ValidateAndConnectTo(validFilePath);
+
// Setup (second part)
importer.Cancel();
- var importResult = importer.Import(observableList, validFilePath);
+ var importResult = importer.Import(importTarget, validFilePath);
Assert.IsFalse(importResult);
// Call
- importResult = importer.Import(observableList, validFilePath);
+ importResult = importer.Import(importTarget, validFilePath);
// Assert
Assert.IsTrue(importResult);
- Assert.AreEqual(18, observableList.Count);
- CollectionAssert.AllItemsAreNotNull(observableList);
- CollectionAssert.AllItemsAreUnique(observableList);
+ Assert.IsNotNull(importTarget.Parent.HydraulicBoundaryDatabase);
+ Assert.AreEqual(18, importTarget.Parent.HydraulicBoundaryDatabase.Locations.Count);
+ CollectionAssert.AllItemsAreNotNull(importTarget.Parent.HydraulicBoundaryDatabase.Locations);
+ CollectionAssert.AllItemsAreUnique(importTarget.Parent.HydraulicBoundaryDatabase.Locations);
}
[Test]
- public void Import_ImportingToValidTargetWithEmptyFile_ThrowsCriticalFileReadException()
- {
- // Setup
- var mocks = new MockRepository();
- var observer = mocks.StrictMock();
- mocks.ReplayAll();
-
- string corruptPath = Path.Combine(testDataPath, "empty.sqlite");
- var expectedExceptionMessage = new FileReaderErrorMessageBuilder(corruptPath).
- Build(RingtoetsHydraRingIOResources.Error_HydraulicBoundaryLocation_read_from_database);
-
- var importer = new HydraulicBoundaryLocationsImporter
- {
- ProgressChanged = IncrementProgress
- };
-
- var observableHydraulicBoundaryLocationList = new ObservableList();
- observableHydraulicBoundaryLocationList.Attach(observer);
-
- // Call
- TestDelegate test = () => importer.Import(observableHydraulicBoundaryLocationList, corruptPath);
-
- // Assert
- CriticalFileReadException exception = Assert.Throws(test);
- Assert.AreEqual(expectedExceptionMessage, exception.Message);
- Assert.IsInstanceOf(exception.InnerException);
- CollectionAssert.IsEmpty(observableHydraulicBoundaryLocationList, "No items should be added to collection when import in an empty database.");
- Assert.AreEqual(1, progress);
-
- mocks.VerifyAll(); // Expect no calls on 'observer'
- }
-
- [Test]
public void Import_ImportingFileWithCorruptSchema_AbortAndLog()
{
// Setup
var mocks = new MockRepository();
var observer = mocks.StrictMock();
+ var assessmentSection = mocks.StrictMock();
mocks.ReplayAll();
+ var importTarget = new HydraulicBoundaryDatabaseContext(assessmentSection);
+
string corruptPath = Path.Combine(testDataPath, "corruptschema.sqlite");
var expectedLogMessage = string.Format("Fout bij het lezen van bestand '{0}': Kritieke fout opgetreden bij het uitlezen van waardes uit kolommen in de database. Het bestand wordt overgeslagen.", corruptPath);
- var importer = new HydraulicBoundaryLocationsImporter
- {
- ProgressChanged = IncrementProgress
- };
+ importer.ProgressChanged = IncrementProgress;
- var observableHydraulicBoundaryLocationList = new ObservableList();
- observableHydraulicBoundaryLocationList.Attach(observer);
+ importTarget.Attach(observer);
var importResult = true;
+ importer.ValidateAndConnectTo(corruptPath);
+
// Call
- Action call = () => importResult = importer.Import(observableHydraulicBoundaryLocationList, corruptPath);
+ Action call = () => importResult = importer.Import(importTarget, corruptPath);
// Assert
TestHelper.AssertLogMessageIsGenerated(call, expectedLogMessage, 1);
Assert.IsFalse(importResult);
- CollectionAssert.IsEmpty(observableHydraulicBoundaryLocationList, "No items should be added to collection when import from corrupt database.");
+ Assert.IsNull(importTarget.Parent.HydraulicBoundaryDatabase, "No HydraulicBoundaryDatabase object should be created when import from corrupt database.");
Assert.AreEqual(2, progress);
mocks.VerifyAll(); // Expect no calls on 'observer'
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Plugin.Test/Ringtoets.HydraRing.Plugin.Test.csproj
===================================================================
diff -u -r16fef01c5d2d8ef8d15c652585efa85125ba7b25 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Plugin.Test/Ringtoets.HydraRing.Plugin.Test.csproj (.../Ringtoets.HydraRing.Plugin.Test.csproj) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Plugin.Test/Ringtoets.HydraRing.Plugin.Test.csproj (.../Ringtoets.HydraRing.Plugin.Test.csproj) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -88,6 +88,10 @@
{4d840673-3812-4338-a352-84854e32b8a0}
Ringtoets.Common.Forms
+
+ {11F1F874-45AF-43E4-8AE5-15A5C9593E28}
+ Ringtoets.Integration.Data
+
{70F8CC9C-5BC8-4FB2-B201-EAE7FA8088C2}
Ringtoets.HydraRing.Data
Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSectionBase.cs
===================================================================
diff -u -r33c64ea2cd6b287bf5954e63a548d89dadb7f153 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSectionBase.cs (.../AssessmentSectionBase.cs) (revision 33c64ea2cd6b287bf5954e63a548d89dadb7f153)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSectionBase.cs (.../AssessmentSectionBase.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -40,7 +40,6 @@
protected AssessmentSectionBase()
{
Name = "";
- HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
}
///
@@ -61,7 +60,7 @@
///
/// Gets or sets the hydraulic boundary database.
///
- public HydraulicBoundaryDatabase HydraulicBoundaryDatabase { get; private set; }
+ public HydraulicBoundaryDatabase HydraulicBoundaryDatabase { get; set; }
///
/// Gets the failure mechanisms corresponding to the assessment section.
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryDatabaseProperties.cs
===================================================================
diff -u -rde09e649989e2c4f858632345841f7b9971debe3 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryDatabaseProperties.cs (.../HydraulicBoundaryDatabaseProperties.cs) (revision de09e649989e2c4f858632345841f7b9971debe3)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryDatabaseProperties.cs (.../HydraulicBoundaryDatabaseProperties.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -47,7 +47,7 @@
{
get
{
- return data.BoundaryDatabase.FilePath;
+ return data.Parent.HydraulicBoundaryDatabase.FilePath;
}
}
@@ -62,7 +62,7 @@
{
get
{
- return data.BoundaryDatabase.Locations.Select(loc => new HydraulicBoundaryLocationProperties(loc)).ToArray();
+ return data.Parent.HydraulicBoundaryDatabase.Locations.Select(loc => new HydraulicBoundaryLocationProperties(loc)).ToArray();
}
}
}
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionView.cs
===================================================================
diff -u -r9a95c55a73a9b31f1698a289cf02f1002eeff185 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionView.cs (.../AssessmentSectionView.cs) (revision 9a95c55a73a9b31f1698a289cf02f1002eeff185)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionView.cs (.../AssessmentSectionView.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -64,7 +64,7 @@
if (data != null)
{
SetDataToMap();
- data.HydraulicBoundaryDatabase.Attach(this);
+ data.Attach(this);
}
}
}
@@ -110,11 +110,16 @@
}
var points = data.ReferenceLine.Points.ToList();
- return points.Count > 0 ? new MapLineData(data.ReferenceLine.Points) : null;
+ return points.Count > 0 ? new MapLineData(points) : null;
}
private MapData GetHydraulicBoudaryLocations()
{
+ if (data.HydraulicBoundaryDatabase == null)
+ {
+ return null;
+ }
+
var locations = data.HydraulicBoundaryDatabase.Locations.Select(h => h.Location).ToList();
return locations.Count > 0 ? new MapPointData(locations) : null;
}
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs
===================================================================
diff -u -r16fef01c5d2d8ef8d15c652585efa85125ba7b25 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -195,7 +195,7 @@
{
new ReferenceLineContext(nodeData),
nodeData.FailureMechanismContribution,
- new HydraulicBoundaryDatabaseContext(nodeData.HydraulicBoundaryDatabase, nodeData)
+ new HydraulicBoundaryDatabaseContext(nodeData)
};
childNodes.AddRange(nodeData.GetFailureMechanisms());
@@ -394,7 +394,7 @@
RingtoetsFormsResources.FailureMechanismIcon,
null);
- if (string.IsNullOrEmpty(nodeData.BoundaryDatabase.FilePath))
+ if (nodeData.Parent.HydraulicBoundaryDatabase == null)
{
designWaterLevelItem.Enabled = false;
designWaterLevelItem.ToolTipText = HydraringResources.DesignWaterLevel_No_HRD_To_Calculate;
@@ -435,40 +435,46 @@
private static void ValidateAndImportSelectedFile(HydraulicBoundaryDatabaseContext nodeData, string selectedFile)
{
var hydraulicBoundaryLocationsImporter = new HydraulicBoundaryLocationsImporter();
+
+ if (nodeData.Parent.HydraulicBoundaryDatabase == null)
+ {
+ ImportSelectedFile(nodeData, hydraulicBoundaryLocationsImporter, selectedFile);
+ return;
+ }
+
string newVersion;
try
{
- newVersion = hydraulicBoundaryLocationsImporter.GetHydraulicBoundaryDatabaseVersion(selectedFile);
+ hydraulicBoundaryLocationsImporter.ValidateAndConnectTo(selectedFile);
+ newVersion = hydraulicBoundaryLocationsImporter.GetHydraulicBoundaryDatabaseVersion();
}
catch (CriticalFileReadException exception)
{
log.Error(exception.Message, exception);
return;
}
- var currentVersion = nodeData.BoundaryDatabase.Version;
- var currentFilePath = nodeData.BoundaryDatabase.FilePath;
- var newFilePath = selectedFile;
+ var currentVersion = nodeData.Parent.HydraulicBoundaryDatabase.Version;
+ var currentFilePath = nodeData.Parent.HydraulicBoundaryDatabase.FilePath;
+
// Compare
- if ((!string.IsNullOrEmpty(currentFilePath) && currentFilePath != newFilePath) ||
- (!string.IsNullOrEmpty(currentVersion) && currentVersion != newVersion))
+ if (currentVersion != newVersion)
{
// Show dialog
- ShowCleanDialog(nodeData, hydraulicBoundaryLocationsImporter, selectedFile, newVersion);
+ ShowCleanDialog(nodeData, hydraulicBoundaryLocationsImporter, selectedFile);
return;
}
- // Only import immediately when there is nothing set.
- if (string.IsNullOrEmpty(currentFilePath) && string.IsNullOrEmpty(currentVersion) && nodeData.BoundaryDatabase.Locations.Count == 0)
+ if (currentFilePath != selectedFile)
{
- ImportSelectedFile(nodeData, hydraulicBoundaryLocationsImporter, selectedFile, newVersion);
+ // Only set the new file path. Don't import the complete database.
+ SetBoundaryDatabaseData(nodeData, selectedFile);
}
}
private static void ShowCleanDialog(HydraulicBoundaryDatabaseContext nodeData,
HydraulicBoundaryLocationsImporter hydraulicBoundaryLocationsImporter,
- string filePath,
- string version)
+ string filePath)
{
var confirmation = MessageBox.Show(
HydraringResources.Delete_Calculations_Text,
@@ -477,9 +483,9 @@
if (confirmation == DialogResult.OK)
{
- ClearCalculations(nodeData.BaseNode);
+ ClearCalculations(nodeData.Parent);
- ImportSelectedFile(nodeData, hydraulicBoundaryLocationsImporter, filePath, version);
+ ImportSelectedFile(nodeData, hydraulicBoundaryLocationsImporter, filePath);
}
}
@@ -498,21 +504,22 @@
private static void ImportSelectedFile(HydraulicBoundaryDatabaseContext nodeData,
HydraulicBoundaryLocationsImporter hydraulicBoundaryLocationsImporter,
- string selectedFile,
- string newVersion)
+ string selectedFile)
{
- nodeData.BoundaryDatabase.ClearLocations();
- if (hydraulicBoundaryLocationsImporter.Import(nodeData.BoundaryDatabase.Locations, selectedFile))
+ if (hydraulicBoundaryLocationsImporter.Import(nodeData, selectedFile))
{
- SetBoundaryDatabaseData(nodeData, selectedFile, newVersion);
+ SetBoundaryDatabaseData(nodeData);
}
}
- private static void SetBoundaryDatabaseData(HydraulicBoundaryDatabaseContext nodeData, string selectedFile, string version)
+ private static void SetBoundaryDatabaseData(HydraulicBoundaryDatabaseContext nodeData, string selectedFile = null)
{
- nodeData.BoundaryDatabase.FilePath = selectedFile;
- nodeData.BoundaryDatabase.Version = version;
- nodeData.BoundaryDatabase.NotifyObservers();
+ if (!String.IsNullOrEmpty(selectedFile))
+ {
+ nodeData.Parent.HydraulicBoundaryDatabase.FilePath = selectedFile;
+ }
+
+ nodeData.Parent.NotifyObservers();
nodeData.NotifyObservers();
log.InfoFormat(HydraringResources.RingtoetsGuiPlugin_SetBoundaryDatabaseFilePath_Database_on_path__0__linked, selectedFile);
}
Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/AssessmentSectionBaseTest.cs
===================================================================
diff -u -r17574077c6720e02c10f23ac3a0354db35855a05 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/AssessmentSectionBaseTest.cs (.../AssessmentSectionBaseTest.cs) (revision 17574077c6720e02c10f23ac3a0354db35855a05)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/AssessmentSectionBaseTest.cs (.../AssessmentSectionBaseTest.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -23,6 +23,7 @@
Assert.AreEqual(String.Empty, assessmentSection.Name);
Assert.IsNull(assessmentSection.ReferenceLine);
Assert.IsNull(assessmentSection.FailureMechanismContribution);
+ Assert.IsNull(assessmentSection.HydraulicBoundaryDatabase);
}
[Test]
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryDatabasePropertiesTest.cs
===================================================================
diff -u -r7235aeaea6e256141b54459aa33da203e84f280b -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryDatabasePropertiesTest.cs (.../HydraulicBoundaryDatabasePropertiesTest.cs) (revision 7235aeaea6e256141b54459aa33da203e84f280b)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryDatabasePropertiesTest.cs (.../HydraulicBoundaryDatabasePropertiesTest.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -55,9 +55,10 @@
HydraulicBoundaryLocation hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "name", 1.0, 2.0);
HydraulicBoundaryLocationProperties expectedLocationProperties = new HydraulicBoundaryLocationProperties(hydraulicBoundaryLocation);
- HydraulicBoundaryDatabaseContext hydraulicBoundaryDatabaseContext = new HydraulicBoundaryDatabaseContext(new HydraulicBoundaryDatabase(), assessmentSectionBaseMock);
- hydraulicBoundaryDatabaseContext.BoundaryDatabase.FilePath = "Test";
- hydraulicBoundaryDatabaseContext.BoundaryDatabase.Locations.Add(hydraulicBoundaryLocation);
+ HydraulicBoundaryDatabaseContext hydraulicBoundaryDatabaseContext = new HydraulicBoundaryDatabaseContext(assessmentSectionBaseMock);
+ hydraulicBoundaryDatabaseContext.Parent.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
+ hydraulicBoundaryDatabaseContext.Parent.HydraulicBoundaryDatabase.FilePath = "Test";
+ hydraulicBoundaryDatabaseContext.Parent.HydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation);
// Call
HydraulicBoundaryDatabaseProperties properties = new HydraulicBoundaryDatabaseProperties
@@ -66,9 +67,9 @@
};
// Assert
- Assert.AreEqual(hydraulicBoundaryDatabaseContext.BoundaryDatabase.FilePath, properties.FilePath);
+ Assert.AreEqual(hydraulicBoundaryDatabaseContext.Parent.HydraulicBoundaryDatabase.FilePath, properties.FilePath);
CollectionAssert.AllItemsAreInstancesOfType(properties.Locations, typeof(HydraulicBoundaryLocationProperties));
- Assert.AreEqual(1, hydraulicBoundaryDatabaseContext.BoundaryDatabase.Locations.Count);
+ Assert.AreEqual(1, hydraulicBoundaryDatabaseContext.Parent.HydraulicBoundaryDatabase.Locations.Count);
HydraulicBoundaryLocationProperties hydraulicBoundaryLocationProperties = properties.Locations.FirstOrDefault();
Assert.AreEqual(expectedLocationProperties.Name, hydraulicBoundaryLocationProperties.Name);
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/AssessmentSectionBaseTreeNodeInfoTest.cs
===================================================================
diff -u -racbd08302b69fc06e5cade26def0dea4d35e3b92 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/AssessmentSectionBaseTreeNodeInfoTest.cs (.../AssessmentSectionBaseTreeNodeInfoTest.cs) (revision acbd08302b69fc06e5cade26def0dea4d35e3b92)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/AssessmentSectionBaseTreeNodeInfoTest.cs (.../AssessmentSectionBaseTreeNodeInfoTest.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -133,8 +133,8 @@
Assert.AreSame(contribution, objects[1]);
var context = (HydraulicBoundaryDatabaseContext)objects[2];
- Assert.AreSame(assessmentSection.HydraulicBoundaryDatabase, context.BoundaryDatabase);
- Assert.AreSame(assessmentSection, context.BaseNode);
+ Assert.AreSame(assessmentSection.HydraulicBoundaryDatabase, context.Parent.HydraulicBoundaryDatabase);
+ Assert.AreSame(assessmentSection, context.Parent);
Assert.AreSame(failureMechanism, objects[3]);
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs
===================================================================
diff -u -rc6dd26c14af11a7e13f783f578466e46b463165a -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs (.../HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs) (revision c6dd26c14af11a7e13f783f578466e46b463165a)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs (.../HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -61,12 +61,11 @@
{
// Setup
var name = "Hydraulische randvoorwaarden";
- var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
var assessmentSectionMock = mocks.StrictMock();
mocks.ReplayAll();
- var context = new HydraulicBoundaryDatabaseContext(hydraulicBoundaryDatabase, assessmentSectionMock);
+ var context = new HydraulicBoundaryDatabaseContext(assessmentSectionMock);
// Call
var text = info.Text(context);
@@ -104,10 +103,9 @@
var guiMock = mocks.StrictMock();
var menuBuilderMock = mocks.StrictMock();
var treeViewControlMock = mocks.StrictMock();
- var hydraulicBoundaryDatabaseMock = mocks.StrictMock();
var assessmentSectionMock = mocks.StrictMock();
- var nodeData = new HydraulicBoundaryDatabaseContext(hydraulicBoundaryDatabaseMock, assessmentSectionMock);
+ var nodeData = new HydraulicBoundaryDatabaseContext(assessmentSectionMock);
menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock);
menuBuilderMock.Expect(mb => mb.AddSeparator()).Return(menuBuilderMock);
@@ -139,10 +137,9 @@
// Setup
var guiMock = mocks.StrictMock();
var treeViewControlMock = mocks.StrictMock();
- var hydraulicBoundaryDatabaseMock = mocks.StrictMock();
var assessmentSectionMock = mocks.StrictMock();
- var nodeData = new HydraulicBoundaryDatabaseContext(hydraulicBoundaryDatabaseMock, assessmentSectionMock);
+ var nodeData = new HydraulicBoundaryDatabaseContext(assessmentSectionMock);
guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControlMock)).Return(new CustomItemsOnlyContextMenuBuilder());
@@ -165,10 +162,10 @@
// Setup
var guiMock = mocks.StrictMock();
var treeViewControlMock = mocks.StrictMock();
- var hydraulicBoundaryDatabaseMock = mocks.StrictMock();
var assessmentSectionMock = mocks.StrictMock();
- var nodeData = new HydraulicBoundaryDatabaseContext(hydraulicBoundaryDatabaseMock, assessmentSectionMock);
+ var nodeData = new HydraulicBoundaryDatabaseContext(assessmentSectionMock);
+ nodeData.Parent.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControlMock)).Return(new CustomItemsOnlyContextMenuBuilder());
@@ -177,7 +174,7 @@
plugin.Gui = guiMock;
// Call
- nodeData.BoundaryDatabase.FilePath = testDataPath;
+ nodeData.Parent.HydraulicBoundaryDatabase.FilePath = testDataPath;
var contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControlMock);
// Assert
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionViewTest.cs
===================================================================
diff -u -r2e291a9b0eab6c47e06c4d2997e7135a5c8a1467 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionViewTest.cs (.../AssessmentSectionViewTest.cs) (revision 2e291a9b0eab6c47e06c4d2997e7135a5c8a1467)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionViewTest.cs (.../AssessmentSectionViewTest.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -86,6 +86,7 @@
var view = new AssessmentSectionView();
var map = (BaseMap) view.Controls[0];
var assessmentSectionBase = new AssessmentSectionBaseTestClass();
+ assessmentSectionBase.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
assessmentSectionBase.HydraulicBoundaryDatabase.Locations.Add(new HydraulicBoundaryLocation(1, "test", 1.0, 2.0));
// Call
@@ -110,6 +111,7 @@
mocks.ReplayAll();
var assessmentSectionBase = new AssessmentSectionBaseTestClass();
+ assessmentSectionBase.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
assessmentSectionBase.HydraulicBoundaryDatabase.Locations.Add(new HydraulicBoundaryLocation(1, "test", 1.0, 2.0));
assessmentSectionBase.HydraulicBoundaryDatabase.Attach(observer);
@@ -125,7 +127,7 @@
assessmentSectionBase.HydraulicBoundaryDatabase.NotifyObservers();
// Assert
- Assert.AreNotEqual(mapData, map.Data);
+ Assert.AreEqual(mapData, map.Data);
mocks.VerifyAll();
}
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Calculation/Math2D.cs
===================================================================
diff -u -rdd7a5cfb0343fa2350b4143232b94cbba37612e9 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/Calculation/Math2D.cs (.../Math2D.cs) (revision dd7a5cfb0343fa2350b4143232b94cbba37612e9)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Calculation/Math2D.cs (.../Math2D.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -80,10 +80,10 @@
}
return new Point2D
- {
- X = (bOtherLine*cLine - bLine*cOtherLine)/determinant,
- Y = (aLine*cOtherLine - aOtherLine*cLine)/determinant
- };
+ (
+ (bOtherLine*cLine - bLine*cOtherLine)/determinant,
+ (aLine*cOtherLine - aOtherLine*cLine)/determinant
+ );
}
///
@@ -129,15 +129,15 @@
private static Point2D LineIntersectionWithVerticalLine(Point2D point1, Point2D point2, double x)
{
var verticalLineFirstPoint = new Point2D
- {
- X = x,
- Y = 0
- };
+ (
+ x,
+ 0
+ );
var verticalLineSecondPoint = new Point2D
- {
- X = x,
- Y = 1
- };
+ (
+ x,
+ 1
+ );
try
{
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/RingtoetsPipingSurfaceLine.cs
===================================================================
diff -u -rb4ce929ce35e4770f3d8c12d14174de79cc5bee8 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision b4ce929ce35e4770f3d8c12d14174de79cc5bee8)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -325,9 +325,9 @@
for (int i = 0; i < count; i++)
{
result[i] = new Point2D
- {
- X = localCoordinatesX[i], Y = geometryPoints[i].Z
- };
+ (
+ localCoordinatesX[i], geometryPoints[i].Z
+ );
}
return result;
}
@@ -351,9 +351,9 @@
// Determine the vectors from the first coordinate to each other coordinate point
// in the XY world coordinate plane:
Point2D[] worldCoordinates = Points.Select(p => new Point2D
- {
- X = p.X, Y = p.Y
- }).ToArray();
+ (
+ p.X, p.Y
+ )).ToArray();
var worldCoordinateVectors = new Vector[worldCoordinates.Length - 1];
for (int i = 1; i < worldCoordinates.Length; i++)
{
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/SoilLayer2DReader.cs
===================================================================
diff -u -ra3c8c0cb4384de51a18d77cc7bea487f97ba21e1 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/SoilLayer2DReader.cs (.../SoilLayer2DReader.cs) (revision a3c8c0cb4384de51a18d77cc7bea487f97ba21e1)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/SoilLayer2DReader.cs (.../SoilLayer2DReader.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -222,10 +222,10 @@
try
{
return new Point2D
- {
- X = double.Parse(x.Value, CultureInfo.InvariantCulture),
- Y = double.Parse(y.Value, CultureInfo.InvariantCulture)
- };
+ (
+ double.Parse(x.Value, CultureInfo.InvariantCulture),
+ double.Parse(y.Value, CultureInfo.InvariantCulture)
+ );
}
catch (ArgumentNullException e)
{
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Point2DTest.cs
===================================================================
diff -u -rdd7a5cfb0343fa2350b4143232b94cbba37612e9 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Point2DTest.cs (.../Point2DTest.cs) (revision dd7a5cfb0343fa2350b4143232b94cbba37612e9)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Point2DTest.cs (.../Point2DTest.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -37,21 +37,7 @@
Assert.AreEqual(x, point.X);
Assert.AreEqual(y, point.Y);
}
- [Test]
- public void AutomaticProperties_SetAndGetValuesAgain_ReturnedValueShouldBeSameAsSetValue()
- {
- // Setup
- var point = new Point2D();
- // Call
- point.X = 1.1;
- point.Y = 2.2;
-
- // Assert
- Assert.AreEqual(1.1, point.X);
- Assert.AreEqual(2.2, point.Y);
- }
-
[Test]
public void Equals_ToNull_ReturnsFalse()
{
@@ -97,16 +83,8 @@
public void Equals_OtherWithSameCoordinates_ReturnsTrue(double x, double y)
{
// Setup
- var point = new Point2D
- {
- X = x,
- Y = y,
- };
- var otherPoint = new Point2D
- {
- X = x,
- Y = y,
- };
+ var point = new Point2D ( x, y );
+ var otherPoint = new Point2D ( x, y );
// Call
var result = point.Equals(otherPoint);
@@ -125,16 +103,8 @@
var x = random.NextDouble();
var y = random.NextDouble();
- var point = new Point2D
- {
- X = x,
- Y = y,
- };
- var otherPoint = new Point2D
- {
- X = x + deltaX,
- Y = y + deltaY,
- };
+ var point = new Point2D(x, y);
+ var otherPoint = new Point2D(x + deltaX, y + deltaY);
// Call
var result = point.Equals(otherPoint);
@@ -151,16 +121,8 @@
var x = random.NextDouble();
var y = random.NextDouble();
- var point = new Point2D
- {
- X = x,
- Y = y,
- };
- var otherPoint = new Point2D
- {
- X = x,
- Y = y,
- };
+ var point = new Point2D(x, y);
+ var otherPoint = new Point2D(x, y);
// Call
var result = point.GetHashCode();
@@ -188,16 +150,8 @@
public void SubstractOperation_TwoDifferentPoints_Return2DVector()
{
// Setup
- var point1 = new Point2D
- {
- X = 3.0,
- Y = 4.0
- };
- var point2 = new Point2D
- {
- X = 1.0,
- Y = 1.0
- };
+ var point1 = new Point2D(3.0, 4.0);
+ var point2 = new Point2D(1.0, 1.0);
// Call
Vector vector = point1 - point2;
@@ -211,11 +165,7 @@
private static void DoToString_HasCoordinateValues_PrintCoordinateValuesInLocalCulture()
{
// Setup
- var point = new Point2D
- {
- X = 1.1,
- Y = 2.2,
- };
+ var point = new Point2D(1.1, 2.2);
// Call
var stringRepresentation = point.ToString();
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineTest.cs
===================================================================
diff -u -rb4ce929ce35e4770f3d8c12d14174de79cc5bee8 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineTest.cs (.../RingtoetsPipingSurfaceLineTest.cs) (revision b4ce929ce35e4770f3d8c12d14174de79cc5bee8)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineTest.cs (.../RingtoetsPipingSurfaceLineTest.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -128,7 +128,7 @@
Point2D[] lzCoordinates = surfaceLine.ProjectGeometryToLZ().ToArray();
// Assert
- CollectionAssert.AreEqual(new[]{ new Point2D { X = 0.0, Y = originalZ } }, lzCoordinates);
+ CollectionAssert.AreEqual(new[]{ new Point2D ( 0.0, originalZ ) }, lzCoordinates);
}
[Test]
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Segment2DTest.cs
===================================================================
diff -u -rdd7a5cfb0343fa2350b4143232b94cbba37612e9 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Segment2DTest.cs (.../Segment2DTest.cs) (revision dd7a5cfb0343fa2350b4143232b94cbba37612e9)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Segment2DTest.cs (.../Segment2DTest.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -70,16 +70,8 @@
{
// Setup
var random = new Random(22);
- var firstPoint = new Point2D
- {
- X = firstPointX,
- Y = random.NextDouble()
- };
- var secondPoint = new Point2D
- {
- X = secondPointX,
- Y = random.NextDouble()
- };
+ var firstPoint = new Point2D(firstPointX, random.NextDouble());
+ var secondPoint = new Point2D(secondPointX, random.NextDouble());
var segment = new Segment2D(firstPoint, secondPoint);
// Call
@@ -100,16 +92,8 @@
{
// Setup
var random = new Random(22);
- var firstPoint = new Point2D
- {
- X = firstPointX,
- Y = random.NextDouble()
- };
- var secondPoint = new Point2D
- {
- X = secondPointX,
- Y = random.NextDouble()
- };
+ var firstPoint = new Point2D(firstPointX, random.NextDouble());
+ var secondPoint = new Point2D(secondPointX, random.NextDouble());
var segment = new Segment2D(firstPoint, secondPoint);
// Call
@@ -131,16 +115,8 @@
var random = new Random(22);
var x = random.NextDouble();
var y = random.NextDouble();
- var firstPoint = new Point2D
- {
- X = x,
- Y = y
- };
- var secondPoint = new Point2D
- {
- X = x,
- Y = y+difference
- };
+ var firstPoint = new Point2D(x, y);
+ var secondPoint = new Point2D(x, y + difference);
var segment = new Segment2D(firstPoint, secondPoint);
// Call
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil/Segment2DLoopCollectionHelper.cs
===================================================================
diff -u -rdd7a5cfb0343fa2350b4143232b94cbba37612e9 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil/Segment2DLoopCollectionHelper.cs (.../Segment2DLoopCollectionHelper.cs) (revision dd7a5cfb0343fa2350b4143232b94cbba37612e9)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil/Segment2DLoopCollectionHelper.cs (.../Segment2DLoopCollectionHelper.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -40,10 +40,7 @@
{
foreach (var tuple in AllIndexesOfDigit(lines[lineIndex]))
{
- points.Add(tuple.Item1,new Point2D
- {
- X = tuple.Item2, Y = y
- });
+ points.Add(tuple.Item1, new Point2D(tuple.Item2, y));
}
}
return CreateLoop(points);
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilLayer2DTest.cs
===================================================================
diff -u -rdd7a5cfb0343fa2350b4143232b94cbba37612e9 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilLayer2DTest.cs (.../SoilLayer2DTest.cs) (revision dd7a5cfb0343fa2350b4143232b94cbba37612e9)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilLayer2DTest.cs (.../SoilLayer2DTest.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -241,24 +241,13 @@
OuterLoop = new List
{
new Segment2D(
- new Point2D
- {
- X = 1.0, Y = y1
- },
- new Point2D
- {
- X = 1.2, Y = y2
- }),
-
+ new Point2D(1.0, y1),
+ new Point2D(1.2, y2)
+ ),
new Segment2D(
- new Point2D
- {
- X = 1.2, Y = y2
- },
- new Point2D
- {
- X = 1.0, Y = y1
- })
+ new Point2D(1.2, y2),
+ new Point2D(1.0, y1)
+ )
}
};
double bottom;
@@ -281,24 +270,13 @@
OuterLoop = new List
{
new Segment2D(
- new Point2D
- {
- X = -0.1, Y = expectedZ
- },
- new Point2D
- {
- X = 0.1, Y = expectedZ
- }),
-
+ new Point2D(-0.1, expectedZ),
+ new Point2D(0.1, expectedZ)
+ ),
new Segment2D(
- new Point2D
- {
- X = -0.1, Y = expectedZ
- },
- new Point2D
- {
- X = 0.1, Y = expectedZ
- })
+ new Point2D(-0.1, expectedZ),
+ new Point2D(0.1, expectedZ)
+ )
}
};
double bottom;
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilProfileBuilder2DTest.cs
===================================================================
diff -u -rdd7a5cfb0343fa2350b4143232b94cbba37612e9 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilProfileBuilder2DTest.cs (.../SoilProfileBuilder2DTest.cs) (revision dd7a5cfb0343fa2350b4143232b94cbba37612e9)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilProfileBuilder2DTest.cs (.../SoilProfileBuilder2DTest.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -101,22 +101,10 @@
// Setup
var profileName = "SomeProfile";
var builder = new SoilProfileBuilder2D(profileName, 0.0);
- var firstPoint = new Point2D
- {
- X = -0.5, Y = 1.0
- };
- var secondPoint = new Point2D
- {
- X = 0.5, Y = 1.0
- };
- var thirdPoint = new Point2D
- {
- X = 0.5, Y = -1.0
- };
- var fourthPoint = new Point2D
- {
- X = -0.5, Y = -1.0
- };
+ var firstPoint = new Point2D(-0.5, 1.0);
+ var secondPoint = new Point2D(0.5, 1.0);
+ var thirdPoint = new Point2D(0.5, -1.0);
+ var fourthPoint = new Point2D(-0.5, -1.0);
builder.Add(new SoilLayer2D
{
OuterLoop = new List
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj
===================================================================
diff -u -r16fef01c5d2d8ef8d15c652585efa85125ba7b25 -r06f9145d8180df7fd26eac086a3f431c181e4d64
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj (.../Ringtoets.Piping.IO.Test.csproj) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj (.../Ringtoets.Piping.IO.Test.csproj) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
@@ -1,6 +1,5 @@
-
Debug
x86