Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismCreateExtensions.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -r401ea38da560543cd91415c326b9463976b2e80a --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismCreateExtensions.cs (.../GrassCoverErosionInwardsFailureMechanismCreateExtensions.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismCreateExtensions.cs (.../GrassCoverErosionInwardsFailureMechanismCreateExtensions.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -54,7 +54,7 @@ { var metaEntity = new GrassCoverErosionInwardsFailureMechanismMetaEntity { - N = mechanism.GeneralInput.N, + N = (int) mechanism.GeneralInput.N, DikeProfileCollectionSourcePath = mechanism.DikeProfiles.SourcePath }; entity.GrassCoverErosionInwardsFailureMechanismMetaEntities.Add(metaEntity); Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismCreateExtensions.cs =================================================================== diff -u -rac96d7c315129af851634ed5a4a6800b59ede718 -r401ea38da560543cd91415c326b9463976b2e80a --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismCreateExtensions.cs (.../GrassCoverErosionOutwardsFailureMechanismCreateExtensions.cs) (revision ac96d7c315129af851634ed5a4a6800b59ede718) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismCreateExtensions.cs (.../GrassCoverErosionOutwardsFailureMechanismCreateExtensions.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -72,7 +72,7 @@ var metaEntity = new GrassCoverErosionOutwardsFailureMechanismMetaEntity { ForeshoreProfileCollectionSourcePath = failureMechanism.ForeshoreProfiles.SourcePath.DeepClone(), - N = failureMechanism.GeneralInput.N + N = (int) Math.Round(failureMechanism.GeneralInput.N) }; entity.GrassCoverErosionOutwardsFailureMechanismMetaEntities.Add(metaEntity); Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensions.cs =================================================================== diff -u -rac96d7c315129af851634ed5a4a6800b59ede718 -r401ea38da560543cd91415c326b9463976b2e80a --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensions.cs (.../HeightStructuresFailureMechanismCreateExtensions.cs) (revision ac96d7c315129af851634ed5a4a6800b59ede718) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensions.cs (.../HeightStructuresFailureMechanismCreateExtensions.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -93,7 +93,7 @@ { entity.HeightStructuresFailureMechanismMetaEntities.Add(new HeightStructuresFailureMechanismMetaEntity { - N = mechanism.GeneralInput.N, + N = (int) mechanism.GeneralInput.N, HeightStructureCollectionSourcePath = mechanism.HeightStructures.SourcePath.DeepClone(), ForeshoreProfileCollectionSourcePath = mechanism.ForeshoreProfiles.SourcePath.DeepClone() }); Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensions.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -r401ea38da560543cd91415c326b9463976b2e80a --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensions.cs (.../GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensions.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensions.cs (.../GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensions.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.DbContext; +using Core.Common.Base.Data; using Ringtoets.GrassCoverErosionInwards.Data; namespace Application.Ringtoets.Storage.Read.GrassCoverErosionInwards @@ -45,7 +46,8 @@ { throw new ArgumentNullException(nameof(input)); } - input.N = entity.N; + + input.N = (RoundedDouble) entity.N; } } } \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionOutwards/GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensions.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -r401ea38da560543cd91415c326b9463976b2e80a --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionOutwards/GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensions.cs (.../GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensions.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionOutwards/GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensions.cs (.../GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensions.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.DbContext; +using Core.Common.Base.Data; using Ringtoets.GrassCoverErosionOutwards.Data; namespace Application.Ringtoets.Storage.Read.GrassCoverErosionOutwards @@ -46,7 +47,8 @@ { throw new ArgumentNullException(nameof(input)); } - input.N = entity.N; + + input.N = (RoundedDouble) entity.N; } } } \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/HeightStructures/HeightStructuresFailureMechanismMetaEntityReadExtensions.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -r401ea38da560543cd91415c326b9463976b2e80a --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/HeightStructures/HeightStructuresFailureMechanismMetaEntityReadExtensions.cs (.../HeightStructuresFailureMechanismMetaEntityReadExtensions.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/HeightStructures/HeightStructuresFailureMechanismMetaEntityReadExtensions.cs (.../HeightStructuresFailureMechanismMetaEntityReadExtensions.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -20,6 +20,7 @@ // All rights reserved. using Application.Ringtoets.Storage.DbContext; +using Core.Common.Base.Data; using Ringtoets.HeightStructures.Data; namespace Application.Ringtoets.Storage.Read.HeightStructures @@ -41,7 +42,7 @@ { return new GeneralHeightStructuresInput { - N = entity.N + N = (RoundedDouble) entity.N }; } } Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u -r49621ecdce5a2a8f7c8bb689e8cfd6759dfb8fc6 -r401ea38da560543cd91415c326b9463976b2e80a --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismCreateExtensionsTest.cs (.../GrassCoverErosionInwardsFailureMechanismCreateExtensionsTest.cs) (revision 49621ecdce5a2a8f7c8bb689e8cfd6759dfb8fc6) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismCreateExtensionsTest.cs (.../GrassCoverErosionInwardsFailureMechanismCreateExtensionsTest.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -25,6 +25,7 @@ using Application.Ringtoets.Storage.Create.GrassCoverErosionInwards; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.TestUtil; +using Core.Common.Base.Data; using NUnit.Framework; using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.TestUtil; @@ -72,7 +73,7 @@ }, GeneralInput = { - N = 12 + N = (RoundedDouble) 12.0 } }; var registry = new PersistenceRegistry(); @@ -90,7 +91,7 @@ Assert.AreEqual(1, entity.GrassCoverErosionInwardsFailureMechanismMetaEntities.Count); GrassCoverErosionInwardsFailureMechanismMetaEntity generalInputEntity = entity.GrassCoverErosionInwardsFailureMechanismMetaEntities.First(); - Assert.AreEqual(failureMechanism.GeneralInput.N, generalInputEntity.N); + Assert.AreEqual((int) failureMechanism.GeneralInput.N, generalInputEntity.N); Assert.IsNull(generalInputEntity.DikeProfileCollectionSourcePath); } Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u -r49621ecdce5a2a8f7c8bb689e8cfd6759dfb8fc6 -r401ea38da560543cd91415c326b9463976b2e80a --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismCreateExtensionsTest.cs (.../GrassCoverErosionOutwardsFailureMechanismCreateExtensionsTest.cs) (revision 49621ecdce5a2a8f7c8bb689e8cfd6759dfb8fc6) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismCreateExtensionsTest.cs (.../GrassCoverErosionOutwardsFailureMechanismCreateExtensionsTest.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -25,6 +25,8 @@ using Application.Ringtoets.Storage.Create.GrassCoverErosionOutwards; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.TestUtil; +using Core.Common.Base.Data; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.Hydraulics; @@ -198,7 +200,7 @@ public void Create_WithUpdatedN_FailureMechanismMetaUpdated() { // Setup - int n = new Random(21).Next(1, 20); + RoundedDouble n = new Random(21).NextRoundedDouble(1, 20); var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism { GeneralInput = @@ -211,7 +213,7 @@ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry()); // Assert - Assert.AreEqual(n, entity.GrassCoverErosionOutwardsFailureMechanismMetaEntities.Single().N); + Assert.AreEqual((int) n, entity.GrassCoverErosionOutwardsFailureMechanismMetaEntities.Single().N); } [Test] Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u -r49621ecdce5a2a8f7c8bb689e8cfd6759dfb8fc6 -r401ea38da560543cd91415c326b9463976b2e80a --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensionsTest.cs (.../HeightStructuresFailureMechanismCreateExtensionsTest.cs) (revision 49621ecdce5a2a8f7c8bb689e8cfd6759dfb8fc6) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensionsTest.cs (.../HeightStructuresFailureMechanismCreateExtensionsTest.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -25,6 +25,7 @@ using Application.Ringtoets.Storage.Create.HeightStructures; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.TestUtil; +using Core.Common.Base.Data; using NUnit.Framework; using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.TestUtil; @@ -73,7 +74,7 @@ }, GeneralInput = { - N = 7 + N = (RoundedDouble) 7.0 } }; var registry = new PersistenceRegistry(); @@ -90,7 +91,7 @@ Assert.AreEqual(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments); HeightStructuresFailureMechanismMetaEntity metaEntity = entity.HeightStructuresFailureMechanismMetaEntities.First(); - Assert.AreEqual(failureMechanism.GeneralInput.N, metaEntity.N); + Assert.AreEqual((int) failureMechanism.GeneralInput.N, metaEntity.N); Assert.IsNull(metaEntity.HeightStructureCollectionSourcePath); } Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs =================================================================== diff -u -r7d89262d3b971dceec1e987e22d0027bf675c196 -r401ea38da560543cd91415c326b9463976b2e80a --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs (.../AssessmentSectionEntityReadExtensionsTest.cs) (revision 7d89262d3b971dceec1e987e22d0027bf675c196) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs (.../AssessmentSectionEntityReadExtensionsTest.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -739,7 +739,7 @@ Assert.AreEqual(originalInput, section.GrassCoverErosionInwards.InputComments.Body); Assert.AreEqual(originalOutput, section.GrassCoverErosionInwards.OutputComments.Body); Assert.AreEqual(originalNotRelevantText, section.GrassCoverErosionInwards.NotRelevantComments.Body); - Assert.AreEqual(n, section.GrassCoverErosionInwards.GeneralInput.N); + Assert.AreEqual(n, (int) section.GrassCoverErosionInwards.GeneralInput.N); } [Test] @@ -859,7 +859,7 @@ Assert.AreEqual(inputComments, section.GrassCoverErosionOutwards.InputComments.Body); Assert.AreEqual(outputComments, section.GrassCoverErosionOutwards.OutputComments.Body); Assert.AreEqual(notRelevantComments, section.GrassCoverErosionOutwards.NotRelevantComments.Body); - Assert.AreEqual(n, section.GrassCoverErosionOutwards.GeneralInput.N); + Assert.AreEqual(n, (int) section.GrassCoverErosionOutwards.GeneralInput.N); } [Test] Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ClosingStructures/ClosingStructuresFailureMechanismMetaEntityReadExtensionsTest.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -r401ea38da560543cd91415c326b9463976b2e80a --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ClosingStructures/ClosingStructuresFailureMechanismMetaEntityReadExtensionsTest.cs (.../ClosingStructuresFailureMechanismMetaEntityReadExtensionsTest.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ClosingStructures/ClosingStructuresFailureMechanismMetaEntityReadExtensionsTest.cs (.../ClosingStructuresFailureMechanismMetaEntityReadExtensionsTest.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -30,7 +30,7 @@ public class ClosingStructuresFailureMechanismMetaEntityReadExtensionsTest { [Test] - public void Read_Always_ReturnClosingStructuresGeneralInput() + public void Read_Always_ReturnGeneralClosingStructuresInput() { // Setup var entity = new ClosingStructuresFailureMechanismMetaEntity Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/FailureMechanismEntityReadExtensionsTest.cs =================================================================== diff -u -r7d89262d3b971dceec1e987e22d0027bf675c196 -r401ea38da560543cd91415c326b9463976b2e80a --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/FailureMechanismEntityReadExtensionsTest.cs (.../FailureMechanismEntityReadExtensionsTest.cs) (revision 7d89262d3b971dceec1e987e22d0027bf675c196) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/FailureMechanismEntityReadExtensionsTest.cs (.../FailureMechanismEntityReadExtensionsTest.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -945,6 +945,7 @@ public void ReadAsGrassCoverErosionInwardsFailureMechanism_WithCollector_ReturnsNewGrassCoverErosionInwardsFailureMechanismWithPropertiesSet(bool isRelevant) { // Setup + int n = new Random(21).Next(1, 20); var entity = new FailureMechanismEntity { IsRelevant = Convert.ToByte(isRelevant), @@ -955,7 +956,7 @@ { new GrassCoverErosionInwardsFailureMechanismMetaEntity { - N = 3 + N = n } }, CalculationGroupEntity = new CalculationGroupEntity() @@ -974,7 +975,7 @@ Assert.AreEqual(entity.NotRelevantComments, failureMechanism.NotRelevantComments.Body); CollectionAssert.IsEmpty(failureMechanism.Sections); - Assert.AreEqual(3, failureMechanism.GeneralInput.N); + Assert.AreEqual(n, (int) failureMechanism.GeneralInput.N); Assert.IsNull(failureMechanism.DikeProfiles.SourcePath); } @@ -1116,6 +1117,7 @@ public void ReadAsGrassCoverErosionOutwardsFailureMechanism_WithCollector_ReturnsNewGrassCoverErosionOutwardsFailureMechanismWithPropertiesSet(bool isRelevant) { // Setup + int n = new Random(21).Next(1, 20); var entity = new FailureMechanismEntity { IsRelevant = Convert.ToByte(isRelevant), @@ -1126,7 +1128,7 @@ { new GrassCoverErosionOutwardsFailureMechanismMetaEntity { - N = 3 + N = n } }, CalculationGroupEntity = new CalculationGroupEntity() @@ -1145,7 +1147,7 @@ Assert.AreEqual(entity.NotRelevantComments, failureMechanism.NotRelevantComments.Body); CollectionAssert.IsEmpty(failureMechanism.Sections); - Assert.AreEqual(3, failureMechanism.GeneralInput.N); + Assert.AreEqual(n, (int) failureMechanism.GeneralInput.N); Assert.IsNull(failureMechanism.ForeshoreProfiles.SourcePath); } @@ -1813,7 +1815,7 @@ ForeshoreProfile child2 = foreshoreProfiles[1]; Assert.AreEqual("Child1", child2.Id); - Assert.AreEqual(generalInputN, failureMechanism.GeneralInput.N); + Assert.AreEqual(generalInputN, (int) failureMechanism.GeneralInput.N); } [Test] Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensionsTest.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -r401ea38da560543cd91415c326b9463976b2e80a --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensionsTest.cs (.../GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensionsTest.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensionsTest.cs (.../GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensionsTest.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -22,6 +22,8 @@ using System; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Read.GrassCoverErosionInwards; +using Core.Common.Base.Data; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.GrassCoverErosionInwards.Data; @@ -49,19 +51,19 @@ { // Setup var random = new Random(21); - int n = random.Next(1, 20); + RoundedDouble n = random.NextRoundedDouble(1.0, 20.0); var entity = new GrassCoverErosionInwardsFailureMechanismMetaEntity { - N = n + N = (int) n }; var inputToUpdate = new GeneralGrassCoverErosionInwardsInput(); // Call entity.Read(inputToUpdate); // Assert - Assert.AreEqual(n, inputToUpdate.N); + Assert.AreEqual((int) n, (int) inputToUpdate.N); } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismMetaEntityReadExtensionsTest.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -r401ea38da560543cd91415c326b9463976b2e80a --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismMetaEntityReadExtensionsTest.cs (.../GrassCoverErosionOutwardsFailureMechanismMetaEntityReadExtensionsTest.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismMetaEntityReadExtensionsTest.cs (.../GrassCoverErosionOutwardsFailureMechanismMetaEntityReadExtensionsTest.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -22,6 +22,8 @@ using System; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Read.GrassCoverErosionOutwards; +using Core.Common.Base.Data; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.GrassCoverErosionOutwards.Data; @@ -49,19 +51,19 @@ { // Setup var random = new Random(21); - int n = random.Next(1, 20); + RoundedDouble n = random.NextRoundedDouble(1.0, 20.0); var entity = new GrassCoverErosionOutwardsFailureMechanismMetaEntity { - N = n + N = (int) n }; var inputToUpdate = new GeneralGrassCoverErosionOutwardsInput(); // Call entity.Read(inputToUpdate); // Assert - Assert.AreEqual(n, inputToUpdate.N); + Assert.AreEqual((int) n, (int) inputToUpdate.N); } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/HeightStructures/HeightStructuresFailureMechanismMetaEntityReadExtensionsTest.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -r401ea38da560543cd91415c326b9463976b2e80a --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/HeightStructures/HeightStructuresFailureMechanismMetaEntityReadExtensionsTest.cs (.../HeightStructuresFailureMechanismMetaEntityReadExtensionsTest.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/HeightStructures/HeightStructuresFailureMechanismMetaEntityReadExtensionsTest.cs (.../HeightStructuresFailureMechanismMetaEntityReadExtensionsTest.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -30,7 +30,7 @@ public class HeightStructuresFailureMechanismMetaEntityReadExtensionsTest { [Test] - public void Read_Always_ReturnHeightStructuresGeneralInput() + public void Read_Always_ReturnGeneralHeightStructuresInput() { // Setup var entity = new HeightStructuresFailureMechanismMetaEntity @@ -42,7 +42,7 @@ GeneralHeightStructuresInput generalInput = entity.Read(); // Assert - Assert.AreEqual(entity.N, generalInput.N); + Assert.AreEqual(entity.N, (int) generalInput.N); } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityPointStructures/StabilityPointStructureFailureMechanismMetaEntityReadExtensionsTest.cs =================================================================== diff -u -r7d89262d3b971dceec1e987e22d0027bf675c196 -r401ea38da560543cd91415c326b9463976b2e80a --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityPointStructures/StabilityPointStructureFailureMechanismMetaEntityReadExtensionsTest.cs (.../StabilityPointStructureFailureMechanismMetaEntityReadExtensionsTest.cs) (revision 7d89262d3b971dceec1e987e22d0027bf675c196) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityPointStructures/StabilityPointStructureFailureMechanismMetaEntityReadExtensionsTest.cs (.../StabilityPointStructureFailureMechanismMetaEntityReadExtensionsTest.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -30,7 +30,7 @@ public class StabilityPointStructureFailureMechanismMetaEntityReadExtensionsTest { [Test] - public void Read_Always_ReturnStabilityPointStructuresGeneralInput() + public void Read_Always_ReturnGeneralStabilityPointStructuresInput() { // Setup var entity = new StabilityPointStructuresFailureMechanismMetaEntity Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs =================================================================== diff -u -rd1519950f365a9a8d3f4f75186f73e98a6ac6b51 -r401ea38da560543cd91415c326b9463976b2e80a --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs (.../RingtoetsProjectTestHelper.cs) (revision d1519950f365a9a8d3f4f75186f73e98a6ac6b51) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs (.../RingtoetsProjectTestHelper.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -776,7 +776,7 @@ private static void ConfigureHeightStructuresFailureMechanism(HeightStructuresFailureMechanism failureMechanism, IAssessmentSection assessmentSection) { - failureMechanism.GeneralInput.N = 5; + failureMechanism.GeneralInput.N = (RoundedDouble) 5.0; List hydraulicBoundaryLocations = assessmentSection.HydraulicBoundaryDatabase.Locations; @@ -1599,7 +1599,7 @@ private static void ConfigureGrassCoverErosionInwardsFailureMechanism(GrassCoverErosionInwardsFailureMechanism failureMechanism, IAssessmentSection assessmentSection) { - failureMechanism.GeneralInput.N = 15; + failureMechanism.GeneralInput.N = (RoundedDouble) 15; var dikeProfile1 = new DikeProfile(new Point2D(1, 2), new[] { @@ -1754,7 +1754,7 @@ private static void ConfigureGrassCoverErosionOutwardsFailureMechanism(GrassCoverErosionOutwardsFailureMechanism failureMechanism) { - failureMechanism.GeneralInput.N = 15; + failureMechanism.GeneralInput.N = (RoundedDouble) 15.0; ObservableList hydraulicBoundaryLocations = failureMechanism.HydraulicBoundaryLocations; hydraulicBoundaryLocations.Add(new HydraulicBoundaryLocation(0, "HL 1", 100, 200)); Index: Ringtoets/Common/src/Ringtoets.Common.IO/AssessmentSectionSettings.cs =================================================================== diff -u -r6ef5e439a6d9f40ebd9926251945e0935fbbc314 -r401ea38da560543cd91415c326b9463976b2e80a --- Ringtoets/Common/src/Ringtoets.Common.IO/AssessmentSectionSettings.cs (.../AssessmentSectionSettings.cs) (revision 6ef5e439a6d9f40ebd9926251945e0935fbbc314) +++ Ringtoets/Common/src/Ringtoets.Common.IO/AssessmentSectionSettings.cs (.../AssessmentSectionSettings.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using Core.Common.Base.Data; using Ringtoets.Common.Data.AssessmentSection; namespace Ringtoets.Common.IO @@ -29,17 +30,17 @@ /// public class AssessmentSectionSettings { - private AssessmentSectionSettings(string id, int n, bool isDune) + private AssessmentSectionSettings(string id, double n, bool isDune) { AssessmentSectionId = id; - N = n; + N = new RoundedDouble(2, n); IsDune = isDune; } /// /// The 'length effect' parameter. /// - public int N { get; } + public RoundedDouble N { get; } /// /// Gets a value indicating whether this instance is a dune assessment section or not. @@ -57,7 +58,7 @@ /// The identifier of the assessment section. /// The 'length effect' parameter. /// A fully configured . - public static AssessmentSectionSettings CreateDikeAssessmentSectionSettings(string id, int n) + public static AssessmentSectionSettings CreateDikeAssessmentSectionSettings(string id, double n) { return new AssessmentSectionSettings(id, n, false); } Index: Ringtoets/Common/src/Ringtoets.Common.Service/RingtoetsCommonDataCalculationService.cs =================================================================== diff -u -rb3b6c13cf736c134476b3db34281332d01ca86b1 -r401ea38da560543cd91415c326b9463976b2e80a --- Ringtoets/Common/src/Ringtoets.Common.Service/RingtoetsCommonDataCalculationService.cs (.../RingtoetsCommonDataCalculationService.cs) (revision b3b6c13cf736c134476b3db34281332d01ca86b1) +++ Ringtoets/Common/src/Ringtoets.Common.Service/RingtoetsCommonDataCalculationService.cs (.../RingtoetsCommonDataCalculationService.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -67,7 +67,7 @@ /// is not larger than 0. /// /// - public static double ProfileSpecificRequiredProbability(double norm, double failureMechanismContribution, int n) + public static double ProfileSpecificRequiredProbability(double norm, double failureMechanismContribution, RoundedDouble n) { if (!normValidityRange.InRange(norm)) { Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/AssessmentSectionSettingsTest.cs =================================================================== diff -u -rb3b6c13cf736c134476b3db34281332d01ca86b1 -r401ea38da560543cd91415c326b9463976b2e80a --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/AssessmentSectionSettingsTest.cs (.../AssessmentSectionSettingsTest.cs) (revision b3b6c13cf736c134476b3db34281332d01ca86b1) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/AssessmentSectionSettingsTest.cs (.../AssessmentSectionSettingsTest.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -20,6 +20,7 @@ // All rights reserved. using NUnit.Framework; +using Ringtoets.Common.Data.TestUtil; namespace Ringtoets.Common.IO.Test { @@ -31,14 +32,15 @@ { // Setup const string id = "test"; - const int n = 1; + const double n = 1.0; // Call AssessmentSectionSettings result = AssessmentSectionSettings.CreateDikeAssessmentSectionSettings(id, n); // Assert Assert.AreEqual(id, result.AssessmentSectionId); - Assert.AreEqual(n, result.N); + Assert.AreEqual(2, result.N.NumberOfDecimalPlaces); + Assert.AreEqual(n, result.N, result.N.GetAccuracy()); Assert.IsFalse(result.IsDune); } @@ -53,7 +55,8 @@ // Assert Assert.AreEqual(id, result.AssessmentSectionId); - Assert.AreEqual(3, result.N); + Assert.AreEqual(2, result.N.NumberOfDecimalPlaces); + Assert.AreEqual(3.0, result.N, result.N.GetAccuracy()); Assert.IsTrue(result.IsDune); } } Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/RingtoetsCommonDataCalculationServiceTest.cs =================================================================== diff -u -rb3b6c13cf736c134476b3db34281332d01ca86b1 -r401ea38da560543cd91415c326b9463976b2e80a --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/RingtoetsCommonDataCalculationServiceTest.cs (.../RingtoetsCommonDataCalculationServiceTest.cs) (revision b3b6c13cf736c134476b3db34281332d01ca86b1) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/RingtoetsCommonDataCalculationServiceTest.cs (.../RingtoetsCommonDataCalculationServiceTest.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using Core.Common.Base.Data; using NUnit.Framework; using Ringtoets.Common.Data.Hydraulics; @@ -46,10 +47,10 @@ public void ProfileSpecificRequiredProbability_WithValidParameters_ReturnSpecificProbability( [Values(1, 0.5, 0)] double norm, [Values(100, 50, 0)] double failureMechanismContribution, - [Values(10, 1)] int n) + [Values(10, 1)] double n) { // Call - double probability = RingtoetsCommonDataCalculationService.ProfileSpecificRequiredProbability(norm, failureMechanismContribution, n); + double probability = RingtoetsCommonDataCalculationService.ProfileSpecificRequiredProbability(norm, failureMechanismContribution, (RoundedDouble) n); // Assert double expectedProfileSpecificRequiredProbability = norm * (failureMechanismContribution / 100) / n; @@ -59,11 +60,12 @@ [Test] [SetCulture("nl-NL")] public void ProfileSpecificRequiredProbability_WithInvalidNorm_ThrowsArgumentException( - [Values(150, 1 + 1e-6, -1e-6, -150, double.NaN)] double norm) + [Values(150, 1 + 1e-6, -1e-6, -150, double.NaN)] + double norm) { // Setup const double failureMechanismContribution = 50; - const int n = 10; + var n = (RoundedDouble) 10; // Call TestDelegate action = () => RingtoetsCommonDataCalculationService.ProfileSpecificRequiredProbability(norm, failureMechanismContribution, n); @@ -79,11 +81,12 @@ [Test] [SetCulture("nl-NL")] public void ProfileSpecificRequiredProbability_WithInvalidFailureMechanismContribution_ThrowsArgumentException( - [Values(150, 100 + 1e-6, -1e-6, -150, double.NaN)] double failureMechanismContribution) + [Values(150, 100 + 1e-6, -1e-6, -150, double.NaN)] + double failureMechanismContribution) { // Setup const double norm = 0.5; - const int n = 10; + var n = (RoundedDouble) 10; // Call TestDelegate action = () => RingtoetsCommonDataCalculationService.ProfileSpecificRequiredProbability(norm, failureMechanismContribution, n); @@ -97,14 +100,14 @@ } [Test] - public void ProfileSpecificRequiredProbability_WithInvalidN_ThrowsArgumentException([Values(0, -1)] int n) + public void ProfileSpecificRequiredProbability_WithInvalidN_ThrowsArgumentException([Values(0, -1)] double n) { // Setup const double norm = 0.5; const double failureMechanismContribution = 50; // Call - TestDelegate action = () => RingtoetsCommonDataCalculationService.ProfileSpecificRequiredProbability(norm, failureMechanismContribution, n); + TestDelegate action = () => RingtoetsCommonDataCalculationService.ProfileSpecificRequiredProbability(norm, failureMechanismContribution, (RoundedDouble) n); // Assert var exception = Assert.Throws(action); Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/PropertyClasses/DuneErosionFailureMechanismPropertiesTest.cs =================================================================== diff -u -ra3acfc43c74e601ed4e7d3a80f9a7daa58a836c6 -r401ea38da560543cd91415c326b9463976b2e80a --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/PropertyClasses/DuneErosionFailureMechanismPropertiesTest.cs (.../DuneErosionFailureMechanismPropertiesTest.cs) (revision a3acfc43c74e601ed4e7d3a80f9a7daa58a836c6) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/PropertyClasses/DuneErosionFailureMechanismPropertiesTest.cs (.../DuneErosionFailureMechanismPropertiesTest.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -227,10 +227,10 @@ } [Test] - [TestCase(0, TestName = "LenghtEffect_InvalidValue_ThrowsArgumentOutOfRangeExceptionNoNotifications(0)")] - [TestCase(-1, TestName = "LenghtEffect_InvalidValue_ThrowsArgumentOutOfRangeExceptionNoNotifications(-1)")] - [TestCase(-20, TestName = "LenghtEffect_InvalidValue_ThrowsArgumentOutOfRangeExceptionNoNotifications(-20)")] - public void LengthEffect_SetInvalidValue_ThrowsThrowsArgumentOutOfRangeExceptionNoNotifications(double newLengthEffect) + [TestCase(0.0)] + [TestCase(-1.0)] + [TestCase(-20.0)] + public void LengthEffect_SetInvalidValue_ThrowsArgumentOutOfRangeExceptionNoNotifications(double newLengthEffect) { // Setup var mockRepository = new MockRepository(); Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GeneralGrassCoverErosionInwardsInput.cs =================================================================== diff -u -rd337718251f4330d447d555eb1c70df226dd9823 -r401ea38da560543cd91415c326b9463976b2e80a --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GeneralGrassCoverErosionInwardsInput.cs (.../GeneralGrassCoverErosionInwardsInput.cs) (revision d337718251f4330d447d555eb1c70df226dd9823) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GeneralGrassCoverErosionInwardsInput.cs (.../GeneralGrassCoverErosionInwardsInput.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -31,15 +31,15 @@ /// public class GeneralGrassCoverErosionInwardsInput { - private static readonly Range validityRangeN = new Range(1, 20); - private int n; + private static readonly Range validityRangeN = new Range(1.0, 20.0); + private RoundedDouble n; /// /// Initializes a new instance of the class. /// public GeneralGrassCoverErosionInwardsInput() { - n = 2; + n = new RoundedDouble(2, 2.0); CriticalOvertoppingModelFactor = 1.0; FbFactor = new TruncatedNormalDistribution(2) { @@ -79,7 +79,7 @@ /// /// Thrown when the is not in /// the interval [1, 20]. - public int N + public RoundedDouble N { get { @@ -92,7 +92,7 @@ throw new ArgumentOutOfRangeException(nameof(value), string.Format(Resources.N_Value_should_be_in_Range_0_, validityRangeN)); } - n = value; + n = value.ToPrecision(n.NumberOfDecimalPlaces); } } Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextProperties.cs =================================================================== diff -u -rac96d7c315129af851634ed5a4a6800b59ede718 -r401ea38da560543cd91415c326b9463976b2e80a --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextProperties.cs (.../GrassCoverErosionInwardsFailureMechanismContextProperties.cs) (revision ac96d7c315129af851634ed5a4a6800b59ede718) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextProperties.cs (.../GrassCoverErosionInwardsFailureMechanismContextProperties.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -23,6 +23,7 @@ using System.Collections.Generic; using System.ComponentModel; using Core.Common.Base; +using Core.Common.Base.Data; using Core.Common.Gui.Attributes; using Core.Common.Gui.PropertyBag; using Core.Common.Util.Attributes; @@ -63,10 +64,12 @@ { throw new ArgumentNullException(nameof(data)); } + if (handler == null) { throw new ArgumentNullException(nameof(handler)); } + Data = data; propertyChangeHandler = handler; } @@ -78,7 +81,7 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_LengthEffect))] [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_N_DisplayName))] [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_N_Description))] - public int LengthEffect + public RoundedDouble LengthEffect { get { @@ -104,6 +107,7 @@ { return false; } + return true; } Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GeneralGrassCoverErosionInwardsInputTest.cs =================================================================== diff -u -raeb6e1a439617630e7613b9ed5af152c345fa2c6 -r401ea38da560543cd91415c326b9463976b2e80a --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GeneralGrassCoverErosionInwardsInputTest.cs (.../GeneralGrassCoverErosionInwardsInputTest.cs) (revision aeb6e1a439617630e7613b9ed5af152c345fa2c6) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GeneralGrassCoverErosionInwardsInputTest.cs (.../GeneralGrassCoverErosionInwardsInputTest.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -71,7 +71,8 @@ var inputParameters = new GeneralGrassCoverErosionInwardsInput(); // Assert - Assert.AreEqual(2, inputParameters.N); + Assert.AreEqual(2, inputParameters.N.NumberOfDecimalPlaces); + Assert.AreEqual(2.0, inputParameters.N, inputParameters.N.GetAccuracy()); DistributionAssert.AreEqual(fbFactor, inputParameters.FbFactor); DistributionAssert.AreEqual(fnFactor, inputParameters.FnFactor); @@ -83,34 +84,34 @@ } [Test] - [TestCase(1)] - [TestCase(10)] - [TestCase(20)] - public void N_ValueInsideValidRegion_DoesNotThrow(int value) + [TestCase(1.0)] + [TestCase(10.0)] + [TestCase(20.0)] + public void N_ValueInsideValidRegion_DoesNotThrow(double value) { // Setup var generalGrassCoverErosionInwardsInput = new GeneralGrassCoverErosionInwardsInput(); // Call - TestDelegate test = () => generalGrassCoverErosionInwardsInput.N = value; + TestDelegate test = () => generalGrassCoverErosionInwardsInput.N = (RoundedDouble) value; // Assert Assert.DoesNotThrow(test); Assert.AreEqual(value, generalGrassCoverErosionInwardsInput.N); } [Test] - [TestCase(-10)] - [TestCase(0)] - [TestCase(21)] - [TestCase(50)] - public void N_ValueOutsideValidRegion_ThrowsArgumentOutOfRangeException(int value) + [TestCase(-10.0)] + [TestCase(0.0)] + [TestCase(21.0)] + [TestCase(50.0)] + public void N_ValueOutsideValidRegion_ThrowsArgumentOutOfRangeException(double value) { // Setup var generalGrassCoverErosionInwardsInput = new GeneralGrassCoverErosionInwardsInput(); // Call - TestDelegate test = () => generalGrassCoverErosionInwardsInput.N = value; + TestDelegate test = () => generalGrassCoverErosionInwardsInput.N = (RoundedDouble) value; // Assert const string expectedMessage = "De waarde voor 'N' moet in het bereik [1, 20] liggen."; Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextPropertiesTest.cs =================================================================== diff -u -ra3acfc43c74e601ed4e7d3a80f9a7daa58a836c6 -r401ea38da560543cd91415c326b9463976b2e80a --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextPropertiesTest.cs (.../GrassCoverErosionInwardsFailureMechanismContextPropertiesTest.cs) (revision a3acfc43c74e601ed4e7d3a80f9a7daa58a836c6) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextPropertiesTest.cs (.../GrassCoverErosionInwardsFailureMechanismContextPropertiesTest.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -22,10 +22,12 @@ using System; using System.ComponentModel; using Core.Common.Base; +using Core.Common.Base.Data; using Core.Common.TestUtil; using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.PropertyClasses; using Ringtoets.Common.Forms.TestUtil; using Ringtoets.GrassCoverErosionInwards.Data; @@ -102,6 +104,8 @@ { IsRelevant = isRelevant }; + + // Call var properties = new GrassCoverErosionInwardsFailureMechanismContextProperties( new GrassCoverErosionInwardsFailureMechanismContext(failureMechanism, assessmentSection), handler); @@ -110,7 +114,7 @@ Assert.AreEqual("Dijken en dammen - Grasbekleding erosie kruin en binnentalud", properties.Name); Assert.AreEqual("GEKB", properties.Code); Assert.AreEqual(isRelevant, properties.IsRelevant); - Assert.AreEqual(2, properties.LengthEffect); + Assert.AreEqual(2.0, properties.LengthEffect, properties.LengthEffect.GetAccuracy()); var generalInput = new GeneralGrassCoverErosionInwardsInput(); Assert.AreEqual(generalInput.FbFactor.Mean, properties.FbFactor.Mean); @@ -264,10 +268,10 @@ } [Test] - [TestCase(0, TestName = "LenghtEffect_InvalidValue_ThrowsArgumentOutOfRangeExceptionNoNotifications(0)")] - [TestCase(-1, TestName = "LenghtEffect_InvalidValue_ThrowsArgumentOutOfRangeExceptionNoNotifications(-1)")] - [TestCase(-20, TestName = "LenghtEffect_InvalidValue_ThrowsArgumentOutOfRangeExceptionNoNotifications(-20)")] - public void LengthEffect_SetInvalidValue_ThrowsThrowsArgumentOutOfRangeExceptionNoNotifications(int newLengthEffect) + [TestCase(0.0)] + [TestCase(-1.0)] + [TestCase(-20.0)] + public void LengthEffect_SetInvalidValue_ThrowsArgumentOutOfRangeExceptionNoNotifications(double newLengthEffect) { // Setup var assessmentSection = mockRepository.Stub(); @@ -288,7 +292,7 @@ changeHandler); // Call - TestDelegate test = () => properties.LengthEffect = newLengthEffect; + TestDelegate test = () => properties.LengthEffect = (RoundedDouble) newLengthEffect; // Assert Assert.Throws(test); @@ -297,10 +301,10 @@ } [Test] - [TestCase(1)] - [TestCase(10)] - [TestCase(20)] - public void LengthEffect_SetValidValue_UpdateDataAndNotifyObservers(int newLengthEffect) + [TestCase(1.0)] + [TestCase(10.0)] + [TestCase(20.0)] + public void LengthEffect_SetValidValue_UpdateDataAndNotifyObservers(double newLengthEffect) { // Setup var observable = mockRepository.StrictMock(); @@ -324,7 +328,7 @@ changeHandler); // Call - properties.LengthEffect = newLengthEffect; + properties.LengthEffect = (RoundedDouble) newLengthEffect; // Assert Assert.AreEqual(newLengthEffect, failureMechanism.GeneralInput.N); Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Data/GeneralGrassCoverErosionOutwardsInput.cs =================================================================== diff -u -r04cf5f873b69cb330aeda88b622e286b2aefa852 -r401ea38da560543cd91415c326b9463976b2e80a --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Data/GeneralGrassCoverErosionOutwardsInput.cs (.../GeneralGrassCoverErosionOutwardsInput.cs) (revision 04cf5f873b69cb330aeda88b622e286b2aefa852) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Data/GeneralGrassCoverErosionOutwardsInput.cs (.../GeneralGrassCoverErosionOutwardsInput.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -31,15 +31,15 @@ /// public class GeneralGrassCoverErosionOutwardsInput { - private static readonly Range validityRangeN = new Range(1, 20); - private int n; + private static readonly Range validityRangeN = new Range(1, 20); + private RoundedDouble n; /// /// Initializes a new instance of the class. /// public GeneralGrassCoverErosionOutwardsInput() { - n = 2; + n = new RoundedDouble(2, 2.0); GeneralWaveConditionsInput = new GeneralWaveConditionsInput(1.0, 0.67, 0.0); } @@ -55,7 +55,7 @@ /// /// Thrown when the is not in /// the interval [1, 20]. - public int N + public RoundedDouble N { get { @@ -68,7 +68,8 @@ throw new ArgumentOutOfRangeException(nameof(value), string.Format(Resources.N_Value_should_be_in_Range_0_, validityRangeN)); } - n = value; + + n = value.ToPrecision(n.NumberOfDecimalPlaces); } } Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsFailureMechanismProperties.cs =================================================================== diff -u -r0f28eb71a18af127ad376776ebd2cd597a0aa5c5 -r401ea38da560543cd91415c326b9463976b2e80a --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsFailureMechanismProperties.cs (.../GrassCoverErosionOutwardsFailureMechanismProperties.cs) (revision 0f28eb71a18af127ad376776ebd2cd597a0aa5c5) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsFailureMechanismProperties.cs (.../GrassCoverErosionOutwardsFailureMechanismProperties.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -28,14 +28,13 @@ using Core.Common.Util.Attributes; using Ringtoets.Common.Forms.PropertyClasses; using Ringtoets.GrassCoverErosionOutwards.Data; -using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; using RingtoetsRevetmentFormsResources = Ringtoets.Revetment.Forms.Properties.Resources; namespace Ringtoets.GrassCoverErosionOutwards.Forms.PropertyClasses { /// - /// ViewModel of for properties panel. + /// ViewModel of for properties panel. /// public class GrassCoverErosionOutwardsFailureMechanismProperties : ObjectProperties { @@ -55,10 +54,12 @@ { throw new ArgumentNullException(nameof(failureMechanism)); } + if (handler == null) { throw new ArgumentNullException(nameof(handler)); } + Data = failureMechanism; propertyChangeHandler = handler; } @@ -70,7 +71,7 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_LengthEffect))] [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_N_DisplayName))] [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_N_Description))] - public int LengthEffect + public RoundedDouble LengthEffect { get { @@ -96,6 +97,7 @@ { return false; } + return true; } Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.Test/GeneralGrassCoverErosionOutwardsInputTest.cs =================================================================== diff -u -rfcd32c8e949b4581cc20adcaa7cf7639fcb69d20 -r401ea38da560543cd91415c326b9463976b2e80a --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.Test/GeneralGrassCoverErosionOutwardsInputTest.cs (.../GeneralGrassCoverErosionOutwardsInputTest.cs) (revision fcd32c8e949b4581cc20adcaa7cf7639fcb69d20) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.Test/GeneralGrassCoverErosionOutwardsInputTest.cs (.../GeneralGrassCoverErosionOutwardsInputTest.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using Core.Common.Base.Data; using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.TestUtil; @@ -36,41 +37,42 @@ var inputParameters = new GeneralGrassCoverErosionOutwardsInput(); // Assert - Assert.AreEqual(2, inputParameters.N); + Assert.AreEqual(2, inputParameters.N.NumberOfDecimalPlaces); + Assert.AreEqual(2.0, inputParameters.N, inputParameters.N.GetAccuracy()); Assert.AreEqual(1.0, inputParameters.GeneralWaveConditionsInput.A, inputParameters.GeneralWaveConditionsInput.A.GetAccuracy()); Assert.AreEqual(0.67, inputParameters.GeneralWaveConditionsInput.B, inputParameters.GeneralWaveConditionsInput.B.GetAccuracy()); Assert.AreEqual(0.0, inputParameters.GeneralWaveConditionsInput.C, inputParameters.GeneralWaveConditionsInput.C.GetAccuracy()); } [Test] - [TestCase(1)] - [TestCase(10)] - [TestCase(20)] - public void N_ValueInsideValidRegion_DoesNotThrow(int value) + [TestCase(1.0)] + [TestCase(10.0)] + [TestCase(20.0)] + public void N_ValueInsideValidRegion_DoesNotThrow(double value) { // Setup var generalGrassCoverErosionInwardsInput = new GeneralGrassCoverErosionOutwardsInput(); // Call - TestDelegate test = () => generalGrassCoverErosionInwardsInput.N = value; + TestDelegate test = () => generalGrassCoverErosionInwardsInput.N = (RoundedDouble) value; // Assert Assert.DoesNotThrow(test); - Assert.AreEqual(value, generalGrassCoverErosionInwardsInput.N); + Assert.AreEqual(value, generalGrassCoverErosionInwardsInput.N, generalGrassCoverErosionInwardsInput.N.GetAccuracy()); } [Test] - [TestCase(-10)] - [TestCase(0)] - [TestCase(21)] - [TestCase(50)] - public void N_ValueOutsideValidRegion_ThrowsArgumentOutOfRangeException(int value) + [TestCase(-10.0)] + [TestCase(0.0)] + [TestCase(21.0)] + [TestCase(50.0)] + public void N_ValueOutsideValidRegion_ThrowsArgumentOutOfRangeException(double value) { // Setup var generalGrassCoverErosionInwardsInput = new GeneralGrassCoverErosionOutwardsInput(); // Call - TestDelegate test = () => generalGrassCoverErosionInwardsInput.N = value; + TestDelegate test = () => generalGrassCoverErosionInwardsInput.N = (RoundedDouble) value; // Assert const string expectedMessage = "De waarde voor 'N' moet in het bereik [1, 20] liggen."; Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsFailureMechanismPropertiesTest.cs =================================================================== diff -u -ra3acfc43c74e601ed4e7d3a80f9a7daa58a836c6 -r401ea38da560543cd91415c326b9463976b2e80a --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsFailureMechanismPropertiesTest.cs (.../GrassCoverErosionOutwardsFailureMechanismPropertiesTest.cs) (revision a3acfc43c74e601ed4e7d3a80f9a7daa58a836c6) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsFailureMechanismPropertiesTest.cs (.../GrassCoverErosionOutwardsFailureMechanismPropertiesTest.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -22,10 +22,12 @@ using System; using System.ComponentModel; using Core.Common.Base; +using Core.Common.Base.Data; using Core.Common.Gui.PropertyBag; using Core.Common.TestUtil; using NUnit.Framework; using Rhino.Mocks; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.PropertyClasses; using Ringtoets.Common.Forms.TestUtil; using Ringtoets.GrassCoverErosionOutwards.Data; @@ -98,7 +100,7 @@ Assert.AreEqual(failureMechanism.GeneralInput.GeneralWaveConditionsInput.A, properties.A); Assert.AreEqual(failureMechanism.GeneralInput.GeneralWaveConditionsInput.B, properties.B); Assert.AreEqual(failureMechanism.GeneralInput.GeneralWaveConditionsInput.C, properties.C); - Assert.AreEqual(2, properties.LengthEffect); + Assert.AreEqual(2.0, properties.LengthEffect, properties.LengthEffect.GetAccuracy()); } [Test] @@ -222,10 +224,10 @@ } [Test] - [TestCase(0)] - [TestCase(-1)] - [TestCase(-20)] - public void LengthEffect_SetInvalidValue_ThrowsArgumentOutOfRangeExceptionNoNotifications(int newLengthEffect) + [TestCase(0.0)] + [TestCase(-1.0)] + [TestCase(-20.0)] + public void LengthEffect_SetInvalidValue_ThrowsArgumentOutOfRangeExceptionNoNotifications(double newLengthEffect) { // Setup var mockRepository = new MockRepository(); @@ -244,7 +246,7 @@ var properties = new GrassCoverErosionOutwardsFailureMechanismProperties(failureMechanism, changeHandler); // Call - TestDelegate test = () => properties.LengthEffect = newLengthEffect; + TestDelegate test = () => properties.LengthEffect = (RoundedDouble) newLengthEffect; // Assert Assert.Throws(test); @@ -256,7 +258,7 @@ [TestCase(1)] [TestCase(10)] [TestCase(20)] - public void LengthEffect_SetValidValue_UpdateDataAndNotifyObservers(int newLengthEffect) + public void LengthEffect_SetValidValue_UpdateDataAndNotifyObservers(double newLengthEffect) { // Setup var mockRepository = new MockRepository(); @@ -276,10 +278,10 @@ var properties = new GrassCoverErosionOutwardsFailureMechanismProperties(failureMechanism, changeHandler); // Call - properties.LengthEffect = newLengthEffect; + properties.LengthEffect = (RoundedDouble) newLengthEffect; // Assert - Assert.AreEqual(newLengthEffect, failureMechanism.GeneralInput.N); + Assert.AreEqual(newLengthEffect, failureMechanism.GeneralInput.N, failureMechanism.GeneralInput.N.GetAccuracy()); Assert.IsTrue(changeHandler.Called); mockRepository.VerifyAll(); } Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Service.Test/GrassCoverErosionOutwardsWaveConditionsCalculationServiceTest.cs =================================================================== diff -u -rc0532d07766ecad2566f7cfa4a97a9aeb6e8540c -r401ea38da560543cd91415c326b9463976b2e80a --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Service.Test/GrassCoverErosionOutwardsWaveConditionsCalculationServiceTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationServiceTest.cs) (revision c0532d07766ecad2566f7cfa4a97a9aeb6e8540c) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Service.Test/GrassCoverErosionOutwardsWaveConditionsCalculationServiceTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationServiceTest.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -102,6 +102,7 @@ }); Assert.IsFalse(isValid); } + mockRepository.VerifyAll(); } @@ -134,6 +135,7 @@ }); Assert.IsFalse(isValid); } + mockRepository.VerifyAll(); } @@ -166,6 +168,7 @@ }); Assert.IsFalse(isValid); } + mockRepository.VerifyAll(); } @@ -198,6 +201,7 @@ }); Assert.IsFalse(isValid); } + mockRepository.VerifyAll(); } @@ -230,6 +234,7 @@ }); Assert.IsFalse(isValid); } + mockRepository.VerifyAll(); } @@ -262,6 +267,7 @@ }); Assert.IsFalse(isValid); } + mockRepository.VerifyAll(); } @@ -297,6 +303,7 @@ }); Assert.IsFalse(isValid); } + mockRepository.VerifyAll(); } @@ -335,6 +342,7 @@ }); Assert.IsFalse(isValid); } + mockRepository.VerifyAll(); } @@ -453,6 +461,7 @@ CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[7]); }); } + mockRepository.VerifyAll(); } @@ -520,6 +529,7 @@ CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[7]); }); } + mockRepository.VerifyAll(); } @@ -583,6 +593,7 @@ HydraRingDataEqualityHelper.AreEqual(expectedInput, actualInput); } } + mockRepository.VerifyAll(); } @@ -616,6 +627,7 @@ // Assert Assert.IsFalse(calculation.HasOutput); } + mockRepository.VerifyAll(); } @@ -652,6 +664,7 @@ Assert.IsNull(calculation.Output); Assert.IsTrue(waveConditionsCosineCalculator.IsCanceled); } + mockRepository.VerifyAll(); } @@ -684,6 +697,7 @@ Assert.IsNotNull(calculation.Output); Assert.AreEqual(3, calculation.Output.Items.Count()); } + mockRepository.VerifyAll(); } @@ -774,6 +788,7 @@ Assert.AreEqual("Berekening is mislukt voor alle waterstanden.", exception.Message); Assert.IsNull(calculation.Output); } + mockRepository.VerifyAll(); } @@ -862,6 +877,7 @@ targetNorm, waveConditionsOutputs[0]); } + mockRepository.VerifyAll(); } @@ -969,7 +985,7 @@ mockRepository.VerifyAll(); } - private static double CalculateTargetNorm(double norm, double contribution, int N) + private static double CalculateTargetNorm(double norm, double contribution, RoundedDouble N) { return norm * (contribution / 100) / N; } Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/GeneralHeightStructuresInput.cs =================================================================== diff -u -r8036936a18ebe45fafa40d67a016424a32668391 -r401ea38da560543cd91415c326b9463976b2e80a --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/GeneralHeightStructuresInput.cs (.../GeneralHeightStructuresInput.cs) (revision 8036936a18ebe45fafa40d67a016424a32668391) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/GeneralHeightStructuresInput.cs (.../GeneralHeightStructuresInput.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -31,15 +31,15 @@ /// public class GeneralHeightStructuresInput { - private static readonly Range validityRangeN = new Range(1, 20); - private int n; + private static readonly Range validityRangeN = new Range(1, 20); + private RoundedDouble n; /// /// Initializes a new instance of the class. /// public GeneralHeightStructuresInput() { - n = 2; + n = new RoundedDouble(2, 2.0); GravitationalAcceleration = new RoundedDouble(2, 9.81); @@ -63,7 +63,7 @@ /// /// Thrown when the is not in /// the interval [1, 20]. - public int N + public RoundedDouble N { get { @@ -76,7 +76,8 @@ throw new ArgumentOutOfRangeException(nameof(value), string.Format(Resources.N_Value_should_be_in_Range_0_, validityRangeN)); } - n = value; + + n = value.ToPrecision(n.NumberOfDecimalPlaces); } } Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PropertyClasses/HeightStructuresFailureMechanismProperties.cs =================================================================== diff -u -rac96d7c315129af851634ed5a4a6800b59ede718 -r401ea38da560543cd91415c326b9463976b2e80a --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PropertyClasses/HeightStructuresFailureMechanismProperties.cs (.../HeightStructuresFailureMechanismProperties.cs) (revision ac96d7c315129af851634ed5a4a6800b59ede718) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PropertyClasses/HeightStructuresFailureMechanismProperties.cs (.../HeightStructuresFailureMechanismProperties.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -62,10 +62,12 @@ { throw new ArgumentNullException(nameof(data)); } + if (handler == null) { throw new ArgumentNullException(nameof(handler)); } + Data = data; propertyChangeHandler = handler; } @@ -77,7 +79,7 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_LengthEffect))] [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_N_DisplayName))] [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_N_Description))] - public int LengthEffect + public RoundedDouble LengthEffect { get { @@ -103,6 +105,7 @@ { return false; } + return true; } Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/GeneralHeightStructuresInputTest.cs =================================================================== diff -u -r4bf59bb3506b840b284efe0c0f4431b7876e0e5b -r401ea38da560543cd91415c326b9463976b2e80a --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/GeneralHeightStructuresInputTest.cs (.../GeneralHeightStructuresInputTest.cs) (revision 4bf59bb3506b840b284efe0c0f4431b7876e0e5b) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/GeneralHeightStructuresInputTest.cs (.../GeneralHeightStructuresInputTest.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -51,7 +51,8 @@ var generalHeightStructuresInput = new GeneralHeightStructuresInput(); // Assert - Assert.AreEqual(2, generalHeightStructuresInput.N); + Assert.AreEqual(2, generalHeightStructuresInput.N.NumberOfDecimalPlaces); + Assert.AreEqual(2.0, generalHeightStructuresInput.N, generalHeightStructuresInput.N.GetAccuracy()); Assert.AreEqual(2, generalHeightStructuresInput.GravitationalAcceleration.NumberOfDecimalPlaces); Assert.AreEqual(9.81, generalHeightStructuresInput.GravitationalAcceleration, generalHeightStructuresInput.GravitationalAcceleration.GetAccuracy()); @@ -64,34 +65,34 @@ } [Test] - [TestCase(1)] - [TestCase(10)] - [TestCase(20)] - public void N_ValueInsideValidRegion_DoesNotThrow(int value) + [TestCase(1.0)] + [TestCase(10.0)] + [TestCase(20.0)] + public void N_ValueInsideValidRegion_DoesNotThrow(double value) { // Setup var generalHeightStructuresInput = new GeneralHeightStructuresInput(); // Call - TestDelegate test = () => generalHeightStructuresInput.N = value; + TestDelegate test = () => generalHeightStructuresInput.N = (RoundedDouble) value; // Assert Assert.DoesNotThrow(test); - Assert.AreEqual(value, generalHeightStructuresInput.N); + Assert.AreEqual(value, generalHeightStructuresInput.N, generalHeightStructuresInput.N.GetAccuracy()); } [Test] - [TestCase(-10)] - [TestCase(0)] - [TestCase(21)] - [TestCase(50)] - public void N_ValueOutsideValidRegion_ThrowsArgumentOutOfRangeException(int value) + [TestCase(-10.0)] + [TestCase(0.0)] + [TestCase(21.0)] + [TestCase(50.0)] + public void N_ValueOutsideValidRegion_ThrowsArgumentOutOfRangeException(double value) { // Setup var generalHeightStructuresInput = new GeneralHeightStructuresInput(); // Call - TestDelegate test = () => generalHeightStructuresInput.N = value; + TestDelegate test = () => generalHeightStructuresInput.N = (RoundedDouble) value; // Assert const string expectedMessage = "De waarde voor 'N' moet in het bereik [1, 20] liggen."; Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresFailureMechanismPropertiesTest.cs =================================================================== diff -u -ra3acfc43c74e601ed4e7d3a80f9a7daa58a836c6 -r401ea38da560543cd91415c326b9463976b2e80a --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresFailureMechanismPropertiesTest.cs (.../HeightStructuresFailureMechanismPropertiesTest.cs) (revision a3acfc43c74e601ed4e7d3a80f9a7daa58a836c6) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresFailureMechanismPropertiesTest.cs (.../HeightStructuresFailureMechanismPropertiesTest.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -22,10 +22,12 @@ using System; using System.ComponentModel; using Core.Common.Base; +using Core.Common.Base.Data; using Core.Common.Gui.PropertyBag; using Core.Common.TestUtil; using NUnit.Framework; using Rhino.Mocks; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.PropertyClasses; using Ringtoets.Common.Forms.TestUtil; using Ringtoets.HeightStructures.Data; @@ -236,10 +238,10 @@ } [Test] - [TestCase(0)] - [TestCase(-1)] - [TestCase(-20)] - public void LengthEffect_InvalidValue_ThrowsArgumentOutOfRangeExceptionNoNotifications(int value) + [TestCase(0.0)] + [TestCase(-1.0)] + [TestCase(-20.0)] + public void LengthEffect_InvalidValue_ThrowsArgumentOutOfRangeExceptionNoNotifications(double value) { // Setup var mockRepository = new MockRepository(); @@ -259,7 +261,7 @@ var properties = new HeightStructuresFailureMechanismProperties(failureMechanism, changeHandler); // Call - TestDelegate test = () => properties.LengthEffect = value; + TestDelegate test = () => properties.LengthEffect = (RoundedDouble) value; // Assert Assert.Throws(test); @@ -268,10 +270,10 @@ } [Test] - [TestCase(1)] - [TestCase(10)] - [TestCase(20)] - public void LengthEffect_SetValidValue_UpdateDataAndNotifyObservers(int value) + [TestCase(1.0)] + [TestCase(10.0)] + [TestCase(20.0)] + public void LengthEffect_SetValidValue_UpdateDataAndNotifyObservers(double value) { // Setup var mockRepository = new MockRepository(); @@ -292,10 +294,10 @@ var properties = new HeightStructuresFailureMechanismProperties(failureMechanism, changeHandler); // Call - properties.LengthEffect = value; + properties.LengthEffect = (RoundedDouble) value; // Assert - Assert.AreEqual(value, failureMechanism.GeneralInput.N); + Assert.AreEqual(value, failureMechanism.GeneralInput.N, failureMechanism.GeneralInput.N.GetAccuracy()); Assert.IsTrue(changeHandler.Called); mockRepository.VerifyAll(); } Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Commands/AssessmentSectionFromFileCommandHandler.cs =================================================================== diff -u -rd0a9ae3680252d6a0fd203f4c6b1c3d42cd3873b -r401ea38da560543cd91415c326b9463976b2e80a --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Commands/AssessmentSectionFromFileCommandHandler.cs (.../AssessmentSectionFromFileCommandHandler.cs) (revision d0a9ae3680252d6a0fd203f4c6b1c3d42cd3873b) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Commands/AssessmentSectionFromFileCommandHandler.cs (.../AssessmentSectionFromFileCommandHandler.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -70,14 +70,17 @@ { throw new ArgumentNullException(nameof(dialogParent)); } + if (projectOwner == null) { throw new ArgumentNullException(nameof(projectOwner)); } + if (viewController == null) { throw new ArgumentNullException(nameof(viewController)); } + this.dialogParent = dialogParent; this.projectOwner = projectOwner; this.viewController = viewController; @@ -131,7 +134,7 @@ #region Set AssessmentSection to Project - private static void SetFailureMechanismsValueN(AssessmentSection assessmentSection, int n) + private static void SetFailureMechanismsValueN(AssessmentSection assessmentSection, RoundedDouble n) { assessmentSection.GrassCoverErosionInwards.GeneralInput.N = n; assessmentSection.GrassCoverErosionOutwards.GeneralInput.N = n; @@ -190,7 +193,7 @@ /// The is larger than . /// /// - private static AssessmentSection CreateDikeAssessmentSection(double lowerLimitNorm, double signalingNorm, int n) + private static AssessmentSection CreateDikeAssessmentSection(double lowerLimitNorm, double signalingNorm, RoundedDouble n) { AssessmentSection assessmentSection = CreateDikeAssessmentSection(lowerLimitNorm, signalingNorm); SetFailureMechanismsValueN(assessmentSection, n); @@ -212,7 +215,7 @@ /// The is larger than . /// /// - private static AssessmentSection CreateDuneAssessmentSection(double lowerLimitNorm, double signalingNorm, int n) + private static AssessmentSection CreateDuneAssessmentSection(double lowerLimitNorm, double signalingNorm, RoundedDouble n) { var duneAssessmentSection = new AssessmentSection(AssessmentSectionComposition.Dune, lowerLimitNorm, @@ -298,6 +301,7 @@ log.Error(message, exception); } + return null; } @@ -324,6 +328,7 @@ log.Error(exception.Message, exception.InnerException); return false; } + return true; } Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Commands/AssessmentSectionFromFileCommandHandlerTest.cs =================================================================== diff -u -r43ad5cd168824e7ba3b7b772e94b570d12a0597e -r401ea38da560543cd91415c326b9463976b2e80a --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Commands/AssessmentSectionFromFileCommandHandlerTest.cs (.../AssessmentSectionFromFileCommandHandlerTest.cs) (revision 43ad5cd168824e7ba3b7b772e94b570d12a0597e) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Commands/AssessmentSectionFromFileCommandHandlerTest.cs (.../AssessmentSectionFromFileCommandHandlerTest.cs) (revision 401ea38da560543cd91415c326b9463976b2e80a) @@ -24,6 +24,7 @@ using System.Linq; using System.Reflection; using System.Windows.Forms; +using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Core.Common.Base.TestUtil.Geometry; using Core.Common.Controls.DataGrid; @@ -530,9 +531,9 @@ NormativeNorm = useSignalingValue ? NormType.Signaling : NormType.LowerLimit } }; - assessmentSection.GrassCoverErosionInwards.GeneralInput.N = 2; - assessmentSection.GrassCoverErosionOutwards.GeneralInput.N = 2; - assessmentSection.HeightStructures.GeneralInput.N = 2; + assessmentSection.GrassCoverErosionInwards.GeneralInput.N = (RoundedDouble) 2.0; + assessmentSection.GrassCoverErosionOutwards.GeneralInput.N = (RoundedDouble) 2.0; + assessmentSection.HeightStructures.GeneralInput.N = (RoundedDouble) 2.0; assessmentSection.ReferenceLine = new ReferenceLine(); assessmentSection.ReferenceLine.SetGeometry(new[] { @@ -567,21 +568,21 @@ { GeneralInput = { - N = 3 + N = (RoundedDouble) 3.0 } }, GrassCoverErosionOutwards = { GeneralInput = { - N = 3 + N = (RoundedDouble) 3.0 } }, HeightStructures = { GeneralInput = { - N = 3 + N = (RoundedDouble) 3.0 } } }; @@ -639,6 +640,7 @@ Assert.IsNull(actual); return; } + Assert.IsNotNull(actual); Point2D[] expectedPoints = expected.Points.ToArray(); Point2D[] actualPoints = actual.Points.ToArray();