Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Converters/PipingFailureMechanismEntityConverter.cs =================================================================== diff -u -r98df6e59fb589e5326b8f904dac98d402cb35b9c -r5b63cfab474523f97be999403eb4906a0c376a3d --- Application/Ringtoets/src/Application.Ringtoets.Storage/Converters/PipingFailureMechanismEntityConverter.cs (.../PipingFailureMechanismEntityConverter.cs) (revision 98df6e59fb589e5326b8f904dac98d402cb35b9c) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Converters/PipingFailureMechanismEntityConverter.cs (.../PipingFailureMechanismEntityConverter.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -30,7 +30,7 @@ /// Converter for to /// and to . /// - public class PipingFailureMechanismEntityConverter : IEntityConverter + public class PipingFailureMechanismEntityConverter : IEntityConverter { public PipingFailureMechanism ConvertEntityToModel(FailureMechanismEntity entity) { @@ -39,13 +39,15 @@ throw new ArgumentNullException("entity"); } - if (entity.FailureMechanismType != (int)FailureMechanismType.DikesPipingFailureMechanism) + if (entity.FailureMechanismType != (int) FailureMechanismType.DikesPipingFailureMechanism) { throw new ArgumentException(@"Incorrect modelType", "entity"); } - var failureMechanism = new PipingFailureMechanism(); - failureMechanism.StorageId = entity.FailureMechanismEntityId; + var failureMechanism = new PipingFailureMechanism + { + StorageId = entity.FailureMechanismEntityId + }; return failureMechanism; } Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Persistors/FailureMechanismEntityPersistorBase.cs =================================================================== diff -u -r98df6e59fb589e5326b8f904dac98d402cb35b9c -r5b63cfab474523f97be999403eb4906a0c376a3d --- Application/Ringtoets/src/Application.Ringtoets.Storage/Persistors/FailureMechanismEntityPersistorBase.cs (.../FailureMechanismEntityPersistorBase.cs) (revision 98df6e59fb589e5326b8f904dac98d402cb35b9c) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Persistors/FailureMechanismEntityPersistorBase.cs (.../FailureMechanismEntityPersistorBase.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -58,30 +58,29 @@ this.converter = converter; } - /// /// Loads the as . /// /// to load from. - /// The to load data in. + /// The to load data in. /// Thrown when: /// is null. - /// is null. + /// is null. /// - public void LoadModel(FailureMechanismEntity entity, IFailureMechanism pipingFailureMechanism) + public void LoadModel(FailureMechanismEntity entity, IFailureMechanism failureMechanism) { if (entity == null) { throw new ArgumentNullException("entity"); } - if (pipingFailureMechanism == null) + if (failureMechanism == null) { - throw new ArgumentNullException("pipingFailureMechanism"); + throw new ArgumentNullException("failureMechanism"); } var model = converter.ConvertEntityToModel(entity); - pipingFailureMechanism.StorageId = model.StorageId; + failureMechanism.StorageId = model.StorageId; } /// @@ -168,7 +167,7 @@ /// Thrown when the is read-only. public void RemoveUnModifiedEntries(ICollection parentNavigationProperty) { - var untouchedModifiedList = parentNavigationProperty.Where(e => e.DikeAssessmentSectionEntityId > 0 && !modifiedList.Contains(e)); + var untouchedModifiedList = parentNavigationProperty.Where(e => e.FailureMechanismEntityId > 0 && !modifiedList.Contains(e)); failureMechanismSet.RemoveRange(untouchedModifiedList); modifiedList.Clear(); Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Persistors/HydraulicLocationEntityPersistor.cs =================================================================== diff -u -r98df6e59fb589e5326b8f904dac98d402cb35b9c -r5b63cfab474523f97be999403eb4906a0c376a3d --- Application/Ringtoets/src/Application.Ringtoets.Storage/Persistors/HydraulicLocationEntityPersistor.cs (.../HydraulicLocationEntityPersistor.cs) (revision 98df6e59fb589e5326b8f904dac98d402cb35b9c) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Persistors/HydraulicLocationEntityPersistor.cs (.../HydraulicLocationEntityPersistor.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -158,6 +158,18 @@ } /// + /// Perform actions that can only be executed after has been called. + /// + public void PerformPostSaveActions() + { + foreach (var entry in insertedList) + { + entry.Value.StorageId = entry.Key.HydraulicLocationEntityId; + } + insertedList.Clear(); + } + + /// /// Removes all entities from that are not marked as 'updated'. /// /// List where objects can be searched. @@ -170,18 +182,6 @@ modifiedList.Clear(); } - /// - /// Perform actions that can only be executed after has been called. - /// - public void PerformPostSaveActions() - { - foreach (var entry in insertedList) - { - entry.Value.StorageId = entry.Key.HydraulicLocationEntityId; - } - insertedList.Clear(); - } - private void InsertLocation(ICollection parentNavigationProperty, HydraulicBoundaryLocation location) { if (location == null) Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Persistors/ReferenceLinePersistor.cs =================================================================== diff -u -rf8ff9c1004791467d458ed2818f03be0b9e86552 -r5b63cfab474523f97be999403eb4906a0c376a3d --- Application/Ringtoets/src/Application.Ringtoets.Storage/Persistors/ReferenceLinePersistor.cs (.../ReferenceLinePersistor.cs) (revision f8ff9c1004791467d458ed2818f03be0b9e86552) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Persistors/ReferenceLinePersistor.cs (.../ReferenceLinePersistor.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -4,7 +4,6 @@ using System.Linq; using Application.Ringtoets.Storage.Converters; using Application.Ringtoets.Storage.DbContext; -using Core.Common.Base.Geometry; using Ringtoets.Common.Data; namespace Application.Ringtoets.Storage.Persistors @@ -59,6 +58,20 @@ } } + /// + /// Creates a new based on the information in . + /// + /// The database entity containing the information to set on the new model. + /// A new with properties set from the database. + public ReferenceLine LoadModel(ICollection entityCollection) + { + if (entityCollection == null) + { + throw new ArgumentNullException("entityCollection"); + } + return converter.ConvertEntityToModel(entityCollection); + } + private bool HasChanges(ICollection entityCollection, ReferenceLine otherLine) { var existingLine = converter.ConvertEntityToModel(entityCollection); @@ -80,28 +93,14 @@ } for (int i = 0; i < pointsArray.Length; i++) { - var isXAlmostEqual = Math.Abs(pointsArray[i].X - otherPointsArray[i].X) < 1e-8; - var isYAlmostEqual = Math.Abs(pointsArray[i].Y - otherPointsArray[i].Y) < 1e-8; + var isXAlmostEqual = Math.Abs(pointsArray[i].X - otherPointsArray[i].X) < 1e-6; + var isYAlmostEqual = Math.Abs(pointsArray[i].Y - otherPointsArray[i].Y) < 1e-6; if (!isXAlmostEqual || !isYAlmostEqual) { return true; } } return false; } - - /// - /// Creates a new based on the information in . - /// - /// The database entity containing the information to set on the new model. - /// A new with properties set from the database. - public ReferenceLine LoadModel(ICollection entityCollection) - { - if (entityCollection == null) - { - throw new ArgumentNullException("entityCollection"); - } - return converter.ConvertEntityToModel(entityCollection); - } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj =================================================================== diff -u -ra6371ac68897b69e2efd537fa29bb6564f50fdcf -r5b63cfab474523f97be999403eb4906a0c376a3d --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision a6371ac68897b69e2efd537fa29bb6564f50fdcf) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -85,10 +85,7 @@ - - - Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Converters/PipingFailureMechanismEntityConverterTest.cs =================================================================== diff -u -r98df6e59fb589e5326b8f904dac98d402cb35b9c -r5b63cfab474523f97be999403eb4906a0c376a3d --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Converters/PipingFailureMechanismEntityConverterTest.cs (.../PipingFailureMechanismEntityConverterTest.cs) (revision 98df6e59fb589e5326b8f904dac98d402cb35b9c) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Converters/PipingFailureMechanismEntityConverterTest.cs (.../PipingFailureMechanismEntityConverterTest.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -70,7 +70,7 @@ FailureMechanismEntity entity = new FailureMechanismEntity { FailureMechanismEntityId = storageId, - FailureMechanismType = (int)FailureMechanismType.DikesPipingFailureMechanism, + FailureMechanismType = (int) FailureMechanismType.DikesPipingFailureMechanism, }; // Call @@ -81,7 +81,7 @@ } [Test] - public void ConvertEntityToModel_EntityWithIncorrectType_ReturnsEntityAsModel() + public void ConvertEntityToModel_EntityWithIncorrectType_ThrowsArgumentException() { // Setup PipingFailureMechanismEntityConverter converter = new PipingFailureMechanismEntityConverter(); @@ -90,7 +90,7 @@ FailureMechanismEntity entity = new FailureMechanismEntity { FailureMechanismEntityId = storageId, - FailureMechanismType = (int)FailureMechanismType.DikesMacrostabilityInwardsFailureMechanism, + FailureMechanismType = (int) FailureMechanismType.DikesMacrostabilityInwardsFailureMechanism, }; // Call @@ -149,4 +149,4 @@ Assert.AreEqual(model.StorageId, entity.FailureMechanismEntityId); } } -} +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Converters/ProjectEntityConverterTest.cs =================================================================== diff -u -r290ba0afb9b78a0823f1fa7b4fa01c1011952df8 -r5b63cfab474523f97be999403eb4906a0c376a3d --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Converters/ProjectEntityConverterTest.cs (.../ProjectEntityConverterTest.cs) (revision 290ba0afb9b78a0823f1fa7b4fa01c1011952df8) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Converters/ProjectEntityConverterTest.cs (.../ProjectEntityConverterTest.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -117,9 +117,6 @@ ProjectEntity projectEntity = new ProjectEntity(); ProjectEntityConverter converter = new ProjectEntityConverter(); - var timeStart = DateTime.Now.ToUniversalTime(); - timeStart = Round(timeStart, false); - // Call converter.ConvertModelToEntity(project, projectEntity); @@ -128,12 +125,5 @@ Assert.AreEqual(storageId, projectEntity.ProjectEntityId); Assert.AreEqual(description, projectEntity.Description); } - - private static DateTime Round(DateTime timeStart, bool up) - { - var tickSecond = 10000000; - timeStart = new DateTime(((timeStart.Ticks + (up ? tickSecond : -tickSecond) / 2)/tickSecond)*tickSecond); - return timeStart; - } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Converters/ReferenceLineConverterTest.cs =================================================================== diff -u -r1d52c0ffc913d7803070bd9797d811a991b5c365 -r5b63cfab474523f97be999403eb4906a0c376a3d --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Converters/ReferenceLineConverterTest.cs (.../ReferenceLineConverterTest.cs) (revision 1d52c0ffc913d7803070bd9797d811a991b5c365) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Converters/ReferenceLineConverterTest.cs (.../ReferenceLineConverterTest.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -84,8 +84,8 @@ Assert.AreNotEqual(points, location.Points); for (var i = 0; i < entityCollection.Count; i++) { - Assert.AreEqual(Decimal.ToDouble(entityCollection[i].X), points[i].X, 1e-8); - Assert.AreEqual(Decimal.ToDouble(entityCollection[i].Y), points[i].Y, 1e-8); + Assert.AreEqual(Decimal.ToDouble(entityCollection[i].X), points[i].X, 1e-6); + Assert.AreEqual(Decimal.ToDouble(entityCollection[i].Y), points[i].Y, 1e-6); } } @@ -116,8 +116,8 @@ Assert.AreNotEqual(points, location.Points); for (var i = 0; i < entityCollection.Count; i++) { - Assert.AreEqual(Decimal.ToDouble(entityCollection[i].X), points[i].X, 1e-8); - Assert.AreEqual(Decimal.ToDouble(entityCollection[i].Y), points[i].Y, 1e-8); + Assert.AreEqual(Decimal.ToDouble(entityCollection[i].X), points[i].X, 1e-6); + Assert.AreEqual(Decimal.ToDouble(entityCollection[i].Y), points[i].Y, 1e-6); } } @@ -174,8 +174,8 @@ for (var i = 0; i < entity.Count; i++) { - Assert.AreEqual(points[i].X, Decimal.ToDouble(entity[i].X), 1e-8); - Assert.AreEqual(points[i].Y, Decimal.ToDouble(entity[i].Y), 1e-8); + Assert.AreEqual(points[i].X, Decimal.ToDouble(entity[i].X), 1e-6); + Assert.AreEqual(points[i].Y, Decimal.ToDouble(entity[i].Y), 1e-6); Assert.AreEqual(i, entity[i].Order); } } Fisheye: Tag 5b63cfab474523f97be999403eb4906a0c376a3d refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/DbContext/DikeAssessmentSectionEntityTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 5b63cfab474523f97be999403eb4906a0c376a3d refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/DbContext/FailureMechanismEntityTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 5b63cfab474523f97be999403eb4906a0c376a3d refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/DbContext/ProjectEntityTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs =================================================================== diff -u -r1d52c0ffc913d7803070bd9797d811a991b5c365 -r5b63cfab474523f97be999403eb4906a0c376a3d --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision 1d52c0ffc913d7803070bd9797d811a991b5c365) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -1,4 +1,25 @@ -using System; +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; using System.IO; using System.Linq; using Application.Ringtoets.Storage.TestUtil; Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/DikeAssessmentSectionEntityPersistorTest.cs =================================================================== diff -u -r98df6e59fb589e5326b8f904dac98d402cb35b9c -r5b63cfab474523f97be999403eb4906a0c376a3d --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/DikeAssessmentSectionEntityPersistorTest.cs (.../DikeAssessmentSectionEntityPersistorTest.cs) (revision 98df6e59fb589e5326b8f904dac98d402cb35b9c) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/DikeAssessmentSectionEntityPersistorTest.cs (.../DikeAssessmentSectionEntityPersistorTest.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -318,7 +318,6 @@ const int norm = 30000; var ringtoetsEntities = RingtoetsEntitiesHelper.Create(mockRepository); - mockRepository.ReplayAll(); DikeAssessmentSectionEntity entityToDelete = new DikeAssessmentSectionEntity @@ -362,7 +361,6 @@ { // Setup var ringtoetsEntities = RingtoetsEntitiesHelper.Create(mockRepository); - mockRepository.ReplayAll(); DikeAssessmentSectionEntityPersistor persistor = new DikeAssessmentSectionEntityPersistor(ringtoetsEntities); @@ -680,7 +678,6 @@ { // Setup const long storageId = 1234L; - const long hydraulicLocationEntityId = 5678L; var ringtoetsEntities = RingtoetsEntitiesHelper.Create(mockRepository); @@ -737,21 +734,21 @@ const string name = "test"; const long storageId = 0L; // Newly inserted entities have Id = 0 untill they are saved const int norm = 30000; - DikeAssessmentSectionEntity entityToUpdate = new DikeAssessmentSectionEntity + DikeAssessmentSectionEntity entityToDelete = new DikeAssessmentSectionEntity { DikeAssessmentSectionEntityId = 4567L, - Name = "Entity to update" + Name = "Entity to delete" }; ObservableCollection parentNavigationProperty = new ObservableCollection { - entityToUpdate + entityToDelete }; var ringtoetsEntities = RingtoetsEntitiesHelper.Create(mockRepository); mockRepository.ReplayAll(); - ringtoetsEntities.DikeAssessmentSectionEntities.Add(entityToUpdate); + ringtoetsEntities.DikeAssessmentSectionEntities.Add(entityToDelete); DikeAssessmentSectionEntityPersistor persistor = new DikeAssessmentSectionEntityPersistor(ringtoetsEntities); DikeAssessmentSection dikeAssessmentSection = @@ -765,19 +762,13 @@ HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase() }; - persistor.UpdateModel(parentNavigationProperty, dikeAssessmentSection, 0); + persistor.InsertModel(parentNavigationProperty, dikeAssessmentSection, 0); // Call persistor.RemoveUnModifiedEntries(parentNavigationProperty); // Assert - Assert.AreEqual(2, parentNavigationProperty.Count); - var entity = parentNavigationProperty.SingleOrDefault(x => x.DikeAssessmentSectionEntityId == storageId); - Assert.IsInstanceOf(entity); - Assert.AreEqual(storageId, entity.DikeAssessmentSectionEntityId); - Assert.AreEqual(name, entity.Name); - Assert.AreEqual(norm, entity.Norm); - + CollectionAssert.IsEmpty(ringtoetsEntities.DikeAssessmentSectionEntities); mockRepository.VerifyAll(); } @@ -808,6 +799,7 @@ var ringtoetsEntities = RingtoetsEntitiesHelper.Create(mockRepository); mockRepository.ReplayAll(); + ringtoetsEntities.DikeAssessmentSectionEntities.Add(entityToDelete); ringtoetsEntities.DikeAssessmentSectionEntities.Add(entityToUpdate); DikeAssessmentSectionEntityPersistor persistor = new DikeAssessmentSectionEntityPersistor(ringtoetsEntities); @@ -830,11 +822,8 @@ persistor.RemoveUnModifiedEntries(parentNavigationProperty); // Assert - Assert.AreEqual(2, parentNavigationProperty.Count); - Assert.IsInstanceOf(entityToUpdate); - Assert.AreEqual(storageId, entityToUpdate.DikeAssessmentSectionEntityId); - Assert.AreEqual(name, entityToUpdate.Name); - Assert.AreEqual(norm, entityToUpdate.Norm); + Assert.AreEqual(1, ringtoetsEntities.DikeAssessmentSectionEntities.Count()); + Assert.AreEqual(entityToUpdate, ringtoetsEntities.DikeAssessmentSectionEntities.FirstOrDefault()); mockRepository.VerifyAll(); } @@ -862,6 +851,8 @@ var ringtoetsEntities = RingtoetsEntitiesHelper.Create(mockRepository); mockRepository.ReplayAll(); + ringtoetsEntities.DikeAssessmentSectionEntities.Add(firstEntityToDelete); + ringtoetsEntities.DikeAssessmentSectionEntities.Add(secondEntityToDelete); DikeAssessmentSectionEntityPersistor persistor = new DikeAssessmentSectionEntityPersistor(ringtoetsEntities); DikeAssessmentSection dikeAssessmentSection = new DikeAssessmentSection @@ -870,8 +861,8 @@ }; mockRepository.ReplayAll(); - TestDelegate test = () => persistor.UpdateModel(parentNavigationProperty, dikeAssessmentSection, 0); - Assert.DoesNotThrow(test, "Precondition failed: UpdateModel"); + TestDelegate test = () => persistor.InsertModel(parentNavigationProperty, dikeAssessmentSection, 0); + Assert.DoesNotThrow(test, "Precondition failed: InsertModel"); // Call persistor.RemoveUnModifiedEntries(parentNavigationProperty); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/DikesPipingFailureMechanismEntityPersistorTest.cs =================================================================== diff -u -ra6371ac68897b69e2efd537fa29bb6564f50fdcf -r5b63cfab474523f97be999403eb4906a0c376a3d --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/DikesPipingFailureMechanismEntityPersistorTest.cs (.../DikesPipingFailureMechanismEntityPersistorTest.cs) (revision a6371ac68897b69e2efd537fa29bb6564f50fdcf) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/DikesPipingFailureMechanismEntityPersistorTest.cs (.../DikesPipingFailureMechanismEntityPersistorTest.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -97,7 +97,7 @@ // Assert var exception = Assert.Throws(test); - Assert.AreEqual("pipingFailureMechanism", exception.ParamName); + Assert.AreEqual("failureMechanism", exception.ParamName); } [Test] @@ -425,16 +425,24 @@ }; DikesPipingFailureMechanismEntityPersistor persistor = new DikesPipingFailureMechanismEntityPersistor(ringtoetsEntities); - PipingFailureMechanism pipingFailureMechanism = new PipingFailureMechanism(); + PipingFailureMechanism pipingFailureMechanism = new PipingFailureMechanism + { + StorageId = storageId + }; + ringtoetsEntities.FailureMechanismEntities.Add(entityToDelete); + + // Precondition + persistor.InsertModel(parentNavigationProperty, pipingFailureMechanism); + // Call - persistor.UpdateModel(parentNavigationProperty, pipingFailureMechanism); persistor.RemoveUnModifiedEntries(parentNavigationProperty); // Assert + CollectionAssert.IsEmpty(ringtoetsEntities.FailureMechanismEntities); Assert.AreEqual(2, parentNavigationProperty.Count); var entity = parentNavigationProperty.SingleOrDefault(x => x.FailureMechanismEntityId == storageId); - Assert.IsInstanceOf(entity); + Assert.IsNotNull(entity); Assert.AreEqual(storageId, entity.FailureMechanismEntityId); mockRepository.VerifyAll(); @@ -459,6 +467,8 @@ FailureMechanismEntityId = 4567L, FailureMechanismType = (int) FailureMechanismType.DikesPipingFailureMechanism }; + ringtoetsEntities.FailureMechanismEntities.Add(entityToUpdate); + ringtoetsEntities.FailureMechanismEntities.Add(entityToDelete); ObservableCollection parentNavigationProperty = new ObservableCollection { @@ -479,10 +489,10 @@ persistor.RemoveUnModifiedEntries(parentNavigationProperty); // Assert + Assert.AreEqual(1, ringtoetsEntities.FailureMechanismEntities.Count()); + var entityUpdated = ringtoetsEntities.FailureMechanismEntities.FirstOrDefault(); + Assert.AreEqual(entityToUpdate, entityUpdated); Assert.AreEqual(2, parentNavigationProperty.Count); - Assert.IsInstanceOf(entityToUpdate); - Assert.AreEqual(storageId, entityToUpdate.FailureMechanismEntityId); - mockRepository.VerifyAll(); } @@ -506,14 +516,13 @@ secondEntityToDelete }; - var ringtoetsEntities = mockRepository.StrictMock(); - var dbset = DbTestSet.GetDbTestSet(parentNavigationProperty); - ringtoetsEntities.Expect(d => d.FailureMechanismEntities).Return(dbset); - + var ringtoetsEntities = RingtoetsEntitiesHelper.Create(mockRepository); mockRepository.ReplayAll(); - DikesPipingFailureMechanismEntityPersistor persistor = new DikesPipingFailureMechanismEntityPersistor(ringtoetsEntities); + ringtoetsEntities.FailureMechanismEntities.Add(firstEntityToDelete); + ringtoetsEntities.FailureMechanismEntities.Add(secondEntityToDelete); + DikesPipingFailureMechanismEntityPersistor persistor = new DikesPipingFailureMechanismEntityPersistor(ringtoetsEntities); PipingFailureMechanism pipingFailureMechanism = new PipingFailureMechanism(); TestDelegate test = () => persistor.UpdateModel(parentNavigationProperty, pipingFailureMechanism); @@ -523,6 +532,7 @@ persistor.RemoveUnModifiedEntries(parentNavigationProperty); // Assert + CollectionAssert.IsEmpty(ringtoetsEntities.FailureMechanismEntities); mockRepository.VerifyAll(); } Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/HydraulicLocationEntityPersistorTest.cs =================================================================== diff -u -r98df6e59fb589e5326b8f904dac98d402cb35b9c -r5b63cfab474523f97be999403eb4906a0c376a3d --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/HydraulicLocationEntityPersistorTest.cs (.../HydraulicLocationEntityPersistorTest.cs) (revision 98df6e59fb589e5326b8f904dac98d402cb35b9c) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/HydraulicLocationEntityPersistorTest.cs (.../HydraulicLocationEntityPersistorTest.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -249,7 +249,6 @@ HydraulicBoundaryDatabase hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); hydraulicBoundaryDatabase.Locations.Add(new HydraulicBoundaryLocation(1, "name", Double.PositiveInfinity, 1)); - // Call TestDelegate test = () => persistor.InsertModel(parentNavigationProperty, hydraulicBoundaryDatabase); @@ -441,28 +440,6 @@ } [Test] - public void UpdateModel_LocationNull_ThrowsArgumentException() - { - // Setup - var ringtoetsEntitiesMock = RingtoetsEntitiesHelper.Create(mockRepository); - mockRepository.ReplayAll(); - - var persistor = new HydraulicLocationEntityPersistor(ringtoetsEntitiesMock); - IList parentNavigationProperty = new List(); - - HydraulicBoundaryDatabase hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); - hydraulicBoundaryDatabase.Locations.Add(null); - - // Call - TestDelegate test = () => persistor.UpdateModel(parentNavigationProperty, hydraulicBoundaryDatabase); - - // Assert - Assert.Throws(test); - - mockRepository.VerifyAll(); - } - - [Test] public void UpdateModel_LocationToBig_ThrowsOverflowException() { // Setup @@ -485,7 +462,7 @@ } [Test] - public void RemoveUnModifiedEntries_SingleEntityInParentNavigationPropertySingleHydraulicLocationWithoutStorageId_UpdatedHydraulicLocationAsEntityInParentNavigationPropertyAndOthersDeletedInDbSet() + public void UpdateModel_SingleEntityInParentNavigationPropertySingleHydraulicLocationWithoutStorageId_UpdatedHydraulicLocationAsEntityInParentNavigationPropertyAndOthersDeletedInDbSet() { // Setup const long storageId = 0L; // Newly inserted entities have Id = 0 untill they are saved @@ -517,6 +494,7 @@ persistor.UpdateModel(parentNavigationProperty, hydraulicBoundaryDatabase); // Assert + CollectionAssert.IsEmpty(ringtoetsEntitiesMock.HydraulicLocationEntities); Assert.AreEqual(2, parentNavigationProperty.Count); HydraulicLocationEntity entity = parentNavigationProperty.SingleOrDefault(x => x.HydraulicLocationEntityId == storageId); Assert.IsNotNull(entity); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/ProjectEntityPersistorTest.cs =================================================================== diff -u -ra6371ac68897b69e2efd537fa29bb6564f50fdcf -r5b63cfab474523f97be999403eb4906a0c376a3d --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/ProjectEntityPersistorTest.cs (.../ProjectEntityPersistorTest.cs) (revision a6371ac68897b69e2efd537fa29bb6564f50fdcf) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/ProjectEntityPersistorTest.cs (.../ProjectEntityPersistorTest.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -1,7 +1,26 @@ -using System; +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Data.Entity; using System.Linq; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; @@ -105,11 +124,11 @@ mockRepository.ReplayAll(); ringtoetsEntities.ProjectEntities.Add( - new ProjectEntity - { - ProjectEntityId = storageId, - Description = description - }); + new ProjectEntity + { + ProjectEntityId = storageId, + Description = description + }); ProjectEntityPersistor persistor = new ProjectEntityPersistor(ringtoetsEntities); @@ -377,7 +396,6 @@ var ringtoetsEntities = RingtoetsEntitiesHelper.Create(mockRepository); mockRepository.ReplayAll(); - Project project = new Project { StorageId = storageId, @@ -428,7 +446,7 @@ }; ringtoetsEntities.ProjectEntities.Add(projectEntity); - + ProjectEntityPersistor persistor = new ProjectEntityPersistor(ringtoetsEntities); // Call @@ -536,7 +554,7 @@ // Assert Assert.AreEqual(1, ringtoetsEntities.ProjectEntities.Count()); - CollectionAssert.AreEqual(new[] { entityToUpdate }, ringtoetsEntities.ProjectEntities); + Assert.AreEqual(entityToUpdate, ringtoetsEntities.ProjectEntities.FirstOrDefault()); mockRepository.VerifyAll(); } @@ -584,7 +602,8 @@ persistor.RemoveUnModifiedEntries(); // Assert - CollectionAssert.AreEqual(new[] { entityToUpdate }, ringtoetsEntities.ProjectEntities); + Assert.AreEqual(1, ringtoetsEntities.ProjectEntities.Count()); + Assert.AreEqual(entityToUpdate, ringtoetsEntities.ProjectEntities.FirstOrDefault()); mockRepository.VerifyAll(); } } Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/ReferenceLinePersistorTest.cs =================================================================== diff -u -rf8ff9c1004791467d458ed2818f03be0b9e86552 -r5b63cfab474523f97be999403eb4906a0c376a3d --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/ReferenceLinePersistorTest.cs (.../ReferenceLinePersistorTest.cs) (revision f8ff9c1004791467d458ed2818f03be0b9e86552) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/ReferenceLinePersistorTest.cs (.../ReferenceLinePersistorTest.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -1,7 +1,26 @@ -using System; +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Data.Entity; using System.Linq; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Persistors; @@ -25,7 +44,7 @@ // Assert var parameter = Assert.Throws(call).ParamName; Assert.AreEqual("ringtoetsEntities", parameter); - } + } [Test] public void Constructor_WithContext_DoesNotThrow() @@ -78,7 +97,7 @@ // Assert mocks.VerifyAll(); - } + } [Test] public void InsertModel_WithEmptyEntityCollectionWithReferenceLine_AddsNewEntitiesToContext() @@ -91,11 +110,11 @@ var persistor = new ReferenceLinePersistor(context); var referenceLine = new ReferenceLine(); - referenceLine.SetGeometry(new [] + referenceLine.SetGeometry(new[] { - new Point2D(1,1), - new Point2D(3,2), - new Point2D(1,3) + new Point2D(1, 1), + new Point2D(3, 2), + new Point2D(1, 3) }); // Call @@ -131,9 +150,9 @@ var referenceLine = new ReferenceLine(); referenceLine.SetGeometry(new[] { - new Point2D(1,1), - new Point2D(3,2), - new Point2D(1,3) + new Point2D(1, 1), + new Point2D(3, 2), + new Point2D(1, 3) }); // Call @@ -173,8 +192,8 @@ var entities = new List(); var referenceLine = new ReferenceLine(); - Point2D point = new Point2D(1.2,3.5); - referenceLine.SetGeometry(new [] + Point2D point = new Point2D(1.2, 3.5); + referenceLine.SetGeometry(new[] { point }); @@ -204,13 +223,13 @@ { X = 0, Y = 0, Order = 0 }; - var entities = new List(new [] + var entities = new List(new[] { - referenceLinePointEntity + referenceLinePointEntity }); var referenceLine = new ReferenceLine(); - Point2D point = new Point2D(0,0); - referenceLine.SetGeometry(new [] + Point2D point = new Point2D(0, 0); + referenceLine.SetGeometry(new[] { point }); @@ -225,9 +244,13 @@ persistor.InsertModel(entities, referenceLine); // Assert - Assert.AreEqual(new[] { referenceLinePointEntity }, entities); + Assert.AreEqual(new[] + { + referenceLinePointEntity + }, entities); mocks.VerifyAll(); } + [Test] public void InsertModel_CollectionWithPointReferenceLineNull_ClearsCollection() { @@ -240,7 +263,7 @@ }; var entities = new List(new[] { - referenceLinePointEntity + referenceLinePointEntity }); var mocks = new MockRepository(); @@ -258,7 +281,7 @@ } [Test] - public void LoadModel_WithoutEntityCollection_ThrowsArgumentException() + public void LoadModel_WithoutEntityCollection_ThrowsArgumentNullException() { // Setup var mocks = new MockRepository(); @@ -381,10 +404,10 @@ var entity = entities[i]; var point = referenceLine.Points.ElementAt(i); - Assert.AreEqual(point.X, entity.X); - Assert.AreEqual(referenceLine.Points.ElementAt(i).Y, entity.Y); - Assert.AreEqual(i, entity.Order); - Assert.AreEqual(0, entity.ReferenceLinePointEntityId); + Assert.AreEqual(point.X, entity.X); + Assert.AreEqual(referenceLine.Points.ElementAt(i).Y, entity.Y); + Assert.AreEqual(i, entity.Order); + Assert.AreEqual(0, entity.ReferenceLinePointEntityId); } } @@ -397,7 +420,7 @@ var entity = entities.First(e => e.Order == i); Assert.AreEqual(entity.X, point.X); - Assert.AreEqual(entity.Y, point.Y); + Assert.AreEqual(entity.Y, point.Y); } } } Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/DbTestSet.cs =================================================================== diff -u -ra6371ac68897b69e2efd537fa29bb6564f50fdcf -r5b63cfab474523f97be999403eb4906a0c376a3d --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/DbTestSet.cs (.../DbTestSet.cs) (revision a6371ac68897b69e2efd537fa29bb6564f50fdcf) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/DbTestSet.cs (.../DbTestSet.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -1,3 +1,24 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + using System; using System.Collections; using System.Collections.Generic; @@ -14,9 +35,9 @@ { return new TestDbSet(data); } - } - public class TestDbSet : DbSet, IDbSet where T: class + + public class TestDbSet : DbSet, IDbSet where T : class { private readonly IQueryable queryable; private readonly ObservableCollection collection; @@ -59,6 +80,15 @@ } } + public override IEnumerable RemoveRange(IEnumerable entities) + { + foreach (var e in entities) + { + collection.Remove(e); + } + return entities; + } + public override T Add(T entity) { collection.Add(entity); @@ -71,15 +101,6 @@ return entity; } - public override IEnumerable RemoveRange(IEnumerable entities) - { - foreach(var e in entities) - { - collection.Remove(e); - } - return entities; - } - IEnumerator IEnumerable.GetEnumerator() { return collection.GetEnumerator(); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsEntitiesHelper.cs =================================================================== diff -u -r98df6e59fb589e5326b8f904dac98d402cb35b9c -r5b63cfab474523f97be999403eb4906a0c376a3d --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsEntitiesHelper.cs (.../RingtoetsEntitiesHelper.cs) (revision 98df6e59fb589e5326b8f904dac98d402cb35b9c) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsEntitiesHelper.cs (.../RingtoetsEntitiesHelper.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -1,10 +1,31 @@ +// 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.Collections.ObjectModel; using Application.Ringtoets.Storage.DbContext; using Rhino.Mocks; namespace Application.Ringtoets.Storage.TestUtil { - static public class RingtoetsEntitiesHelper + public static class RingtoetsEntitiesHelper { public static IRingtoetsEntities Create(MockRepository mockRepository) { Index: Core/Common/src/Core.Common.Base/Geometry/Segment2D.cs =================================================================== diff -u -r1b4f4720632f9a691837fa97e777a4637b6739c8 -r5b63cfab474523f97be999403eb4906a0c376a3d --- Core/Common/src/Core.Common.Base/Geometry/Segment2D.cs (.../Segment2D.cs) (revision 1b4f4720632f9a691837fa97e777a4637b6739c8) +++ Core/Common/src/Core.Common.Base/Geometry/Segment2D.cs (.../Segment2D.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -82,7 +82,7 @@ var distanceFirstPoint = FirstPoint.X - x; var distanceSecondPoint = SecondPoint.X - x; - var onPoint = Math.Abs(FirstPoint.X - x) < 1e-8 || Math.Abs(SecondPoint.X - x) < 1e-8; + var onPoint = Math.Abs(FirstPoint.X - x) < 1e-6 || Math.Abs(SecondPoint.X - x) < 1e-6; return onPoint || Math.Sign(distanceFirstPoint) != Math.Sign(distanceSecondPoint); } @@ -93,7 +93,7 @@ /// true if the is vertical. false otherwise. public bool IsVertical() { - return Math.Abs(FirstPoint.X - SecondPoint.X) < 1e-8 && Math.Abs(FirstPoint.Y - SecondPoint.Y) >= 1e-8; + return Math.Abs(FirstPoint.X - SecondPoint.X) < 1e-6 && Math.Abs(FirstPoint.Y - SecondPoint.Y) >= 1e-6; } /// Index: Core/Common/test/Core.Common.Base.Test/Geometry/Math2DTest.cs =================================================================== diff -u -rd305785c5a4330022a5d01cc62ea793a0ae1c5d8 -r5b63cfab474523f97be999403eb4906a0c376a3d --- Core/Common/test/Core.Common.Base.Test/Geometry/Math2DTest.cs (.../Math2DTest.cs) (revision d305785c5a4330022a5d01cc62ea793a0ae1c5d8) +++ Core/Common/test/Core.Common.Base.Test/Geometry/Math2DTest.cs (.../Math2DTest.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -178,7 +178,7 @@ var result = Math2D.LineIntersectionWithLine(new Point2D(start, y1), new Point2D(start + 1, y2), new Point2D(start + 0.5, 0), new Point2D(start + 0.5, 1)); // Assert - Assert.AreEqual((y1 + y2)/2, result.Y, 1e-8); + Assert.AreEqual((y1 + y2)/2, result.Y, 1e-6); } [Test] Index: Core/Common/test/Core.Common.Base.Test/Geometry/Point2DTest.cs =================================================================== diff -u -r1b4f4720632f9a691837fa97e777a4637b6739c8 -r5b63cfab474523f97be999403eb4906a0c376a3d --- Core/Common/test/Core.Common.Base.Test/Geometry/Point2DTest.cs (.../Point2DTest.cs) (revision 1b4f4720632f9a691837fa97e777a4637b6739c8) +++ Core/Common/test/Core.Common.Base.Test/Geometry/Point2DTest.cs (.../Point2DTest.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -106,8 +106,8 @@ } [Test] - [TestCase(1e-8, 0)] - [TestCase(0, 1e-8)] + [TestCase(1e-6, 0)] + [TestCase(0, 1e-6)] public void Equals_CloseToOtherPoint_ReturnsFalse(double deltaX, double deltaY) { // Setup Index: Core/Common/test/Core.Common.Base.Test/Geometry/Point3DTest.cs =================================================================== diff -u -re04155c0cc0efa8bbd13e0a82cb8643711a2dfd6 -r5b63cfab474523f97be999403eb4906a0c376a3d --- Core/Common/test/Core.Common.Base.Test/Geometry/Point3DTest.cs (.../Point3DTest.cs) (revision e04155c0cc0efa8bbd13e0a82cb8643711a2dfd6) +++ Core/Common/test/Core.Common.Base.Test/Geometry/Point3DTest.cs (.../Point3DTest.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -83,9 +83,9 @@ } [Test] - [TestCase(1e-8, 0, 0)] - [TestCase(0, 1e-8, 0)] - [TestCase(0, 0, 1e-8)] + [TestCase(1e-6, 0, 0)] + [TestCase(0, 1e-6, 0)] + [TestCase(0, 0, 1e-6)] public void Equals_CloseToOtherPoint_ReturnsFalse(double deltaX, double deltaY, double deltaZ) { // Setup Index: Core/Common/test/Core.Common.Base.Test/Geometry/Segment2DTest.cs =================================================================== diff -u -re04155c0cc0efa8bbd13e0a82cb8643711a2dfd6 -r5b63cfab474523f97be999403eb4906a0c376a3d --- Core/Common/test/Core.Common.Base.Test/Geometry/Segment2DTest.cs (.../Segment2DTest.cs) (revision e04155c0cc0efa8bbd13e0a82cb8643711a2dfd6) +++ Core/Common/test/Core.Common.Base.Test/Geometry/Segment2DTest.cs (.../Segment2DTest.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -81,10 +81,10 @@ [Test] [TestCase(1, 1, true)] [TestCase(1, 2, false)] - [TestCase(1, 1 + 1e-6, false)] - [TestCase(1, 1 - 1e-6, false)] - [TestCase(1, 1 + 1e-9, true)] - [TestCase(1, 1 - 1e-9, true)] + [TestCase(1, 1 + 1e-5, false)] + [TestCase(1, 1 - 1e-5, false)] + [TestCase(1, 1 + 1e-7, true)] + [TestCase(1, 1 - 1e-7, true)] public void IsVertical_DifferentSetsOfX_ReturnsExpectedValue(double firstPointX, double secondPointX, bool isVertical) { // Setup @@ -102,9 +102,9 @@ [Test] [TestCase(1e-9, false)] - [TestCase(1e-8 + 1e-10, true)] - [TestCase(1e-8 - 1e-10, false)] - [TestCase(1e-7, true)] + [TestCase(1e-6 + 1e-10, true)] + [TestCase(1e-6 - 1e-10, false)] + [TestCase(1e-5, true)] [TestCase(1, true)] public void IsVertical_DifferencesInY_ReturnsExpectedValue(double difference, bool isVertical) { Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs =================================================================== diff -u -r130efbf0e33a64b60dc853347a93f182bf6f1749 -r5b63cfab474523f97be999403eb4906a0c376a3d --- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision 130efbf0e33a64b60dc853347a93f182bf6f1749) +++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -256,7 +256,7 @@ IEnumerable intersectionPoints = Math2D.SegmentsIntersectionWithVerticalLine(segments, l).OrderBy(p => p.Y).ToArray(); - const double intersectionTolerance = 1e-8; + const double intersectionTolerance = 1e-6; bool equalIntersections = Math.Abs((double) (intersectionPoints.First().Y - intersectionPoints.Last().Y)) < intersectionTolerance; if (equalIntersections) Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/DerivedPipingInputTest.cs =================================================================== diff -u -r3721b5bb1ae327907884a90d1a9bd300042e0540 -r5b63cfab474523f97be999403eb4906a0c376a3d --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/DerivedPipingInputTest.cs (.../DerivedPipingInputTest.cs) (revision 3721b5bb1ae327907884a90d1a9bd300042e0540) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/DerivedPipingInputTest.cs (.../DerivedPipingInputTest.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -289,7 +289,7 @@ LognormalDistribution thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer; // Assert - Assert.AreEqual(expectedThickness, thicknessAquiferLayer.Mean, 1e-8); + Assert.AreEqual(expectedThickness, thicknessAquiferLayer.Mean, 1e-6); } [Test] @@ -426,7 +426,7 @@ var thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer; // Assert - Assert.AreEqual(expectedThickness, thicknessAquiferLayer.Mean, 1e-8); + Assert.AreEqual(expectedThickness, thicknessAquiferLayer.Mean, 1e-6); } [Test] Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs =================================================================== diff -u -r3721b5bb1ae327907884a90d1a9bd300042e0540 -r5b63cfab474523f97be999403eb4906a0c376a3d --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs (.../PipingInputTest.cs) (revision 3721b5bb1ae327907884a90d1a9bd300042e0540) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs (.../PipingInputTest.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -516,7 +516,7 @@ LognormalDistribution thicknessAquiferLayer = input.ThicknessAquiferLayer; // Assert - Assert.AreEqual(expectedThickness, thicknessAquiferLayer.Mean, 1e-8); + Assert.AreEqual(expectedThickness, thicknessAquiferLayer.Mean, 1e-6); } [Test] @@ -641,7 +641,7 @@ var thicknessAquiferLayer = input.ThicknessAquiferLayer; // Assert - Assert.AreEqual(expectedThickness, thicknessAquiferLayer.Mean, 1e-8); + Assert.AreEqual(expectedThickness, thicknessAquiferLayer.Mean, 1e-6); } [Test] Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingSoilProfileTest.cs =================================================================== diff -u -r10779bb6a6db2d00f4627b2bc190e7e35e1fee3e -r5b63cfab474523f97be999403eb4906a0c376a3d --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingSoilProfileTest.cs (.../PipingSoilProfileTest.cs) (revision 10779bb6a6db2d00f4627b2bc190e7e35e1fee3e) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingSoilProfileTest.cs (.../PipingSoilProfileTest.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -336,7 +336,7 @@ var result = profile.GetTopAquiferLayerThicknessBelowLevel(1.5); // Assert - Assert.AreEqual(0.4, result, 1e-8); + Assert.AreEqual(0.4, result, 1e-6); } [Test] Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilLayer2DTest.cs =================================================================== diff -u -r10779bb6a6db2d00f4627b2bc190e7e35e1fee3e -r5b63cfab474523f97be999403eb4906a0c376a3d --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilLayer2DTest.cs (.../SoilLayer2DTest.cs) (revision 10779bb6a6db2d00f4627b2bc190e7e35e1fee3e) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilLayer2DTest.cs (.../SoilLayer2DTest.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -26,7 +26,7 @@ } [Test] - [TestCase(1e-8)] + [TestCase(1e-6)] [TestCase(1)] public void OuterLoop_TwoDisconnectedSegment_ThrowsArgumentException(double diff) { @@ -49,7 +49,7 @@ } [Test] - [TestCase(1e-8)] + [TestCase(1e-6)] [TestCase(1)] public void OuterLoop_ThreeDisconnectedSegment_ThrowsArgumentException(double diff) { @@ -119,7 +119,7 @@ } [Test] - [TestCase(1e-8)] + [TestCase(1e-6)] [TestCase(1)] public void AddInnerLoop_TwoDisconnectedSegment_ThrowsArgumentException(double diff) { @@ -142,7 +142,7 @@ } [Test] - [TestCase(1e-8)] + [TestCase(1e-6)] [TestCase(1)] public void AddInnerLoop_ThreeDisconnectedSegment_ThrowsArgumentException(double diff) { Index: Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.Test/PipingCalculatorTest.cs =================================================================== diff -u -r5b575c7019f5ec9d0db2784fda5cb5c7b4df9a90 -r5b63cfab474523f97be999403eb4906a0c376a3d --- Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.Test/PipingCalculatorTest.cs (.../PipingCalculatorTest.cs) (revision 5b575c7019f5ec9d0db2784fda5cb5c7b4df9a90) +++ Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.Test/PipingCalculatorTest.cs (.../PipingCalculatorTest.cs) (revision 5b63cfab474523f97be999403eb4906a0c376a3d) @@ -297,7 +297,7 @@ } [Test] - [TestCase(-1e-8)] + [TestCase(-1e-6)] [TestCase(0)] public void Validate_SoilProfileBottomAtTopLevel_ValidationMessageForHavingTooHighBottom(double bottom) {