Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/DuneErosion/DuneErosionFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u -r2e69ebb9746b28b33fe5061e837c2c4c4155e674 -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/DuneErosion/DuneErosionFailureMechanismSectionResultCreateExtensionsTest.cs (.../DuneErosionFailureMechanismSectionResultCreateExtensionsTest.cs) (revision 2e69ebb9746b28b33fe5061e837c2c4c4155e674) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/DuneErosion/DuneErosionFailureMechanismSectionResultCreateExtensionsTest.cs (.../DuneErosionFailureMechanismSectionResultCreateExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -27,6 +27,7 @@ using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.DuneErosion.Data; namespace Application.Ringtoets.Storage.Test.Create.DuneErosion @@ -39,24 +40,22 @@ { // Setup var random = new Random(21); - var assessmentLayerOneResult = random.NextEnumValue(); - var assessmentLayerTwoAResult = random.NextEnumValue(); - double assessmentLayerThreeResult = random.NextDouble(); var sectionResult = new DuneErosionFailureMechanismSectionResult(new TestFailureMechanismSection()) { - AssessmentLayerOne = assessmentLayerOneResult, - AssessmentLayerTwoA = assessmentLayerTwoAResult, - AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + AssessmentLayerOne = random.NextEnumValue(), + AssessmentLayerTwoA = random.NextEnumValue(), + AssessmentLayerThree = random.NextRoundedDouble() }; // Call DuneErosionSectionResultEntity result = sectionResult.Create(); // Assert - Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne); - Assert.AreEqual(Convert.ToByte(assessmentLayerTwoAResult), result.LayerTwoA); - Assert.AreEqual(assessmentLayerThreeResult, result.LayerThree); + Assert.AreEqual(Convert.ToByte(sectionResult.AssessmentLayerOne), result.LayerOne); + Assert.AreEqual(Convert.ToByte(sectionResult.AssessmentLayerTwoA), result.LayerTwoA); + Assert.AreEqual(sectionResult.AssessmentLayerThree, result.LayerThree, + sectionResult.AssessmentLayerThree.GetAccuracy()); } [Test] Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u -r2e69ebb9746b28b33fe5061e837c2c4c4155e674 -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs (.../GrassCoverErosionOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs) (revision 2e69ebb9746b28b33fe5061e837c2c4c4155e674) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs (.../GrassCoverErosionOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -27,6 +27,7 @@ using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.GrassCoverErosionOutwards.Data; namespace Application.Ringtoets.Storage.Test.Create.GrassCoverErosionOutwards @@ -39,24 +40,22 @@ { // Setup var random = new Random(21); - var assessmentLayerOneResult = random.NextEnumValue(); - var assessmentLayerTwoAResult = random.NextEnumValue(); - double assessmentLayerThreeResult = random.NextDouble(); var sectionResult = new GrassCoverErosionOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection()) { - AssessmentLayerOne = assessmentLayerOneResult, - AssessmentLayerTwoA = assessmentLayerTwoAResult, - AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + AssessmentLayerOne = random.NextEnumValue(), + AssessmentLayerTwoA = random.NextEnumValue(), + AssessmentLayerThree = random.NextRoundedDouble() }; // Call GrassCoverErosionOutwardsSectionResultEntity result = sectionResult.Create(); // Assert - Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne); - Assert.AreEqual(Convert.ToByte(assessmentLayerTwoAResult), result.LayerTwoA); - Assert.AreEqual(assessmentLayerThreeResult, result.LayerThree); + Assert.AreEqual(Convert.ToByte(sectionResult.AssessmentLayerOne), result.LayerOne); + Assert.AreEqual(Convert.ToByte(sectionResult.AssessmentLayerTwoA), result.LayerTwoA); + Assert.AreEqual(sectionResult.AssessmentLayerThree, result.LayerThree, + sectionResult.AssessmentLayerThree.GetAccuracy()); } [Test] Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u -r2e69ebb9746b28b33fe5061e837c2c4c4155e674 -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismSectionResultCreateExtensionsTest.cs (.../GrassCoverSlipOffInwardsFailureMechanismSectionResultCreateExtensionsTest.cs) (revision 2e69ebb9746b28b33fe5061e837c2c4c4155e674) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismSectionResultCreateExtensionsTest.cs (.../GrassCoverSlipOffInwardsFailureMechanismSectionResultCreateExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -27,6 +27,7 @@ using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Integration.Data.StandAlone.SectionResults; namespace Application.Ringtoets.Storage.Test.Create.GrassCoverSlipOffInwards @@ -39,24 +40,22 @@ { // Setup var random = new Random(21); - var assessmentLayerOneResult = random.NextEnumValue(); - var assessmentLayerTwoAResult = random.NextEnumValue(); - double assessmentLayerThreeResult = random.NextDouble(); var sectionResult = new GrassCoverSlipOffInwardsFailureMechanismSectionResult(new TestFailureMechanismSection()) { - AssessmentLayerOne = assessmentLayerOneResult, - AssessmentLayerTwoA = assessmentLayerTwoAResult, - AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + AssessmentLayerOne = random.NextEnumValue(), + AssessmentLayerTwoA = random.NextEnumValue(), + AssessmentLayerThree = random.NextRoundedDouble() }; // Call GrassCoverSlipOffInwardsSectionResultEntity result = sectionResult.Create(); // Assert - Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne); - Assert.AreEqual(Convert.ToByte(assessmentLayerTwoAResult), result.LayerTwoA); - Assert.AreEqual(assessmentLayerThreeResult, result.LayerThree); + Assert.AreEqual(Convert.ToByte(sectionResult.AssessmentLayerOne), result.LayerOne); + Assert.AreEqual(Convert.ToByte(sectionResult.AssessmentLayerTwoA), result.LayerTwoA); + Assert.AreEqual(sectionResult.AssessmentLayerThree, result.LayerThree, + sectionResult.AssessmentLayerThree.GetAccuracy()); } [Test] Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u -r2e69ebb9746b28b33fe5061e837c2c4c4155e674 -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs (.../GrassCoverSlipOffOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs) (revision 2e69ebb9746b28b33fe5061e837c2c4c4155e674) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs (.../GrassCoverSlipOffOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -27,6 +27,7 @@ using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Integration.Data.StandAlone.SectionResults; namespace Application.Ringtoets.Storage.Test.Create.GrassCoverSlipOffOutwards @@ -39,24 +40,22 @@ { // Setup var random = new Random(21); - var assessmentLayerOneResult = random.NextEnumValue(); - var assessmentLayerTwoAResult = random.NextEnumValue(); - double assessmentLayerThreeResult = random.NextDouble(); var sectionResult = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection()) { - AssessmentLayerOne = assessmentLayerOneResult, - AssessmentLayerTwoA = assessmentLayerTwoAResult, - AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + AssessmentLayerOne = random.NextEnumValue(), + AssessmentLayerTwoA = random.NextEnumValue(), + AssessmentLayerThree = random.NextRoundedDouble() }; // Call GrassCoverSlipOffOutwardsSectionResultEntity result = sectionResult.Create(); // Assert - Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne); - Assert.AreEqual(Convert.ToByte(assessmentLayerTwoAResult), result.LayerTwoA); - Assert.AreEqual(assessmentLayerThreeResult, result.LayerThree); + Assert.AreEqual(Convert.ToByte(sectionResult.AssessmentLayerOne), result.LayerOne); + Assert.AreEqual(Convert.ToByte(sectionResult.AssessmentLayerTwoA), result.LayerTwoA); + Assert.AreEqual(sectionResult.AssessmentLayerThree, result.LayerThree, + sectionResult.AssessmentLayerThree.GetAccuracy()); } [Test] Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Microstability/MicrostabilityFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u -r2e69ebb9746b28b33fe5061e837c2c4c4155e674 -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Microstability/MicrostabilityFailureMechanismSectionResultCreateExtensionsTest.cs (.../MicrostabilityFailureMechanismSectionResultCreateExtensionsTest.cs) (revision 2e69ebb9746b28b33fe5061e837c2c4c4155e674) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Microstability/MicrostabilityFailureMechanismSectionResultCreateExtensionsTest.cs (.../MicrostabilityFailureMechanismSectionResultCreateExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -27,6 +27,7 @@ using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Integration.Data.StandAlone.SectionResults; namespace Application.Ringtoets.Storage.Test.Create.Microstability @@ -39,24 +40,22 @@ { // Setup var random = new Random(21); - var assessmentLayerOneResult = random.NextEnumValue(); - var assessmentLayerTwoAResult = random.NextEnumValue(); - double assessmentLayerThreeResult = random.NextDouble(); var sectionResult = new MicrostabilityFailureMechanismSectionResult(new TestFailureMechanismSection()) { - AssessmentLayerOne = assessmentLayerOneResult, - AssessmentLayerTwoA = assessmentLayerTwoAResult, - AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + AssessmentLayerOne = random.NextEnumValue(), + AssessmentLayerTwoA = random.NextEnumValue(), + AssessmentLayerThree = random.NextRoundedDouble() }; // Call MicrostabilitySectionResultEntity result = sectionResult.Create(); // Assert - Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne); - Assert.AreEqual(Convert.ToByte(assessmentLayerTwoAResult), result.LayerTwoA); - Assert.AreEqual(assessmentLayerThreeResult, result.LayerThree); + Assert.AreEqual(Convert.ToByte(sectionResult.AssessmentLayerOne), result.LayerOne); + Assert.AreEqual(Convert.ToByte(sectionResult.AssessmentLayerTwoA), result.LayerTwoA); + Assert.AreEqual(sectionResult.AssessmentLayerThree, result.LayerThree, + sectionResult.AssessmentLayerThree.GetAccuracy()); } [Test] Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PipingStructure/PipingStructureFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u -r2e69ebb9746b28b33fe5061e837c2c4c4155e674 -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PipingStructure/PipingStructureFailureMechanismSectionResultCreateExtensionsTest.cs (.../PipingStructureFailureMechanismSectionResultCreateExtensionsTest.cs) (revision 2e69ebb9746b28b33fe5061e837c2c4c4155e674) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PipingStructure/PipingStructureFailureMechanismSectionResultCreateExtensionsTest.cs (.../PipingStructureFailureMechanismSectionResultCreateExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -27,6 +27,7 @@ using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Integration.Data.StandAlone.SectionResults; namespace Application.Ringtoets.Storage.Test.Create.PipingStructure @@ -39,24 +40,22 @@ { // Setup var random = new Random(21); - var assessmentLayerOneResult = random.NextEnumValue(); - var assessmentLayerTwoAResult = random.NextEnumValue(); - double assessmentLayerThreeResult = random.NextDouble(); var sectionResult = new PipingStructureFailureMechanismSectionResult(new TestFailureMechanismSection()) { - AssessmentLayerOne = assessmentLayerOneResult, - AssessmentLayerTwoA = assessmentLayerTwoAResult, - AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + AssessmentLayerOne = random.NextEnumValue(), + AssessmentLayerTwoA = random.NextEnumValue(), + AssessmentLayerThree = random.NextRoundedDouble() }; // Call PipingStructureSectionResultEntity result = sectionResult.Create(); // Assert - Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne); - Assert.AreEqual(Convert.ToByte(assessmentLayerTwoAResult), result.LayerTwoA); - Assert.AreEqual(assessmentLayerThreeResult, result.LayerThree); + Assert.AreEqual(Convert.ToByte(sectionResult.AssessmentLayerOne), result.LayerOne); + Assert.AreEqual(Convert.ToByte(sectionResult.AssessmentLayerTwoA), result.LayerTwoA); + Assert.AreEqual(sectionResult.AssessmentLayerThree, result.LayerThree, + sectionResult.AssessmentLayerThree.GetAccuracy()); } [Test] Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u -r2e69ebb9746b28b33fe5061e837c2c4c4155e674 -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismSectionResultCreateExtensionsTest.cs (.../StabilityStoneCoverFailureMechanismSectionResultCreateExtensionsTest.cs) (revision 2e69ebb9746b28b33fe5061e837c2c4c4155e674) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismSectionResultCreateExtensionsTest.cs (.../StabilityStoneCoverFailureMechanismSectionResultCreateExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -27,6 +27,7 @@ using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.StabilityStoneCover.Data; namespace Application.Ringtoets.Storage.Test.Create.StabilityStoneCover @@ -39,24 +40,22 @@ { // Setup var random = new Random(21); - var assessmentLayerOneResult = random.NextEnumValue(); - var assessmentLayerTwoAResult = random.NextEnumValue(); - double assessmentLayerThreeResult = random.NextDouble(); var sectionResult = new StabilityStoneCoverFailureMechanismSectionResult(new TestFailureMechanismSection()) { - AssessmentLayerOne = assessmentLayerOneResult, - AssessmentLayerTwoA = assessmentLayerTwoAResult, - AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + AssessmentLayerOne = random.NextEnumValue(), + AssessmentLayerTwoA = random.NextEnumValue(), + AssessmentLayerThree = random.NextRoundedDouble() }; // Call StabilityStoneCoverSectionResultEntity result = sectionResult.Create(); // Assert - Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne); - Assert.AreEqual(Convert.ToByte(assessmentLayerTwoAResult), result.LayerTwoA); - Assert.AreEqual(assessmentLayerThreeResult, result.LayerThree); + Assert.AreEqual(Convert.ToByte(sectionResult.AssessmentLayerOne), result.LayerOne); + Assert.AreEqual(Convert.ToByte(sectionResult.AssessmentLayerTwoA), result.LayerTwoA); + Assert.AreEqual(sectionResult.AssessmentLayerThree, result.LayerThree, + sectionResult.AssessmentLayerThree.GetAccuracy()); } [Test] Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StrengthStabilityLengthwise/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u -r2e69ebb9746b28b33fe5061e837c2c4c4155e674 -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StrengthStabilityLengthwise/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultCreateExtensionsTest.cs (.../StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultCreateExtensionsTest.cs) (revision 2e69ebb9746b28b33fe5061e837c2c4c4155e674) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StrengthStabilityLengthwise/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultCreateExtensionsTest.cs (.../StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultCreateExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -27,6 +27,7 @@ using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Integration.Data.StandAlone.SectionResults; namespace Application.Ringtoets.Storage.Test.Create.StrengthStabilityLengthwise @@ -39,21 +40,20 @@ { // Setup var random = new Random(21); - var assessmentLayerOneResult = random.NextEnumValue(); - double assessmentLayerThreeResult = random.NextDouble(); var sectionResult = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(new TestFailureMechanismSection()) { - AssessmentLayerOne = assessmentLayerOneResult, - AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + AssessmentLayerOne = random.NextEnumValue(), + AssessmentLayerThree = random.NextRoundedDouble() }; // Call StrengthStabilityLengthwiseConstructionSectionResultEntity result = sectionResult.Create(); // Assert - Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne); - Assert.AreEqual(assessmentLayerThreeResult, result.LayerThree); + Assert.AreEqual(Convert.ToByte(sectionResult.AssessmentLayerOne), result.LayerOne); + Assert.AreEqual(sectionResult.AssessmentLayerThree, result.LayerThree, + sectionResult.AssessmentLayerThree.GetAccuracy()); } [Test] Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/TechnicalInnovation/TechnicalInnovationFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u -r2e69ebb9746b28b33fe5061e837c2c4c4155e674 -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/TechnicalInnovation/TechnicalInnovationFailureMechanismSectionResultCreateExtensionsTest.cs (.../TechnicalInnovationFailureMechanismSectionResultCreateExtensionsTest.cs) (revision 2e69ebb9746b28b33fe5061e837c2c4c4155e674) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/TechnicalInnovation/TechnicalInnovationFailureMechanismSectionResultCreateExtensionsTest.cs (.../TechnicalInnovationFailureMechanismSectionResultCreateExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -27,6 +27,7 @@ using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Integration.Data.StandAlone.SectionResults; namespace Application.Ringtoets.Storage.Test.Create.TechnicalInnovation @@ -39,21 +40,20 @@ { // Setup var random = new Random(21); - var assessmentLayerOneResult = random.NextEnumValue(); - double assessmentLayerThreeResult = random.NextDouble(); var sectionResult = new TechnicalInnovationFailureMechanismSectionResult(new TestFailureMechanismSection()) { - AssessmentLayerOne = assessmentLayerOneResult, - AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + AssessmentLayerOne = random.NextEnumValue(), + AssessmentLayerThree = random.NextRoundedDouble() }; // Call TechnicalInnovationSectionResultEntity result = sectionResult.Create(); // Assert - Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne); - Assert.AreEqual(assessmentLayerThreeResult, result.LayerThree); + Assert.AreEqual(Convert.ToByte(sectionResult.AssessmentLayerOne), result.LayerOne); + Assert.AreEqual(sectionResult.AssessmentLayerThree, result.LayerThree, + sectionResult.AssessmentLayerThree.GetAccuracy()); } [Test] Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs =================================================================== diff -u -rfbe227cf3a6743302f63c1bd3281feda0273192c -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs (.../AssessmentSectionEntityReadExtensionsTest.cs) (revision fbe227cf3a6743302f63c1bd3281feda0273192c) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs (.../AssessmentSectionEntityReadExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -114,17 +114,16 @@ } [Test] - [Combinatorial] - public void Read_WithBackgroundData_ReturnsNewAssessmentSectionWithBackgroundData( - [Values(true, false)] bool isConfigured) + public void Read_WithBackgroundData_ReturnsNewAssessmentSectionWithBackgroundData() { // Setup + var random = new Random(21); + const string mapDataName = "Background"; - const double transparency = 0.0; - bool isVisible = isConfigured; + double transparency = random.GetFromRange(0, 1); + bool isVisible = random.NextBoolean(); const BackgroundDataType backgroundDataType = BackgroundDataType.WellKnown; - var random = new Random(21); var wellKnownTileSource = random.NextEnumValue(); string wellKnownTileSourceValue = ((int) wellKnownTileSource).ToString(); @@ -157,7 +156,8 @@ // Assert BackgroundData backgroundData = section.BackgroundData; Assert.AreEqual(isVisible, backgroundData.IsVisible); - Assert.AreEqual(transparency, backgroundData.Transparency); + Assert.AreEqual(transparency, backgroundData.Transparency, + backgroundData.Transparency.GetAccuracy()); Assert.AreEqual(mapDataName, backgroundData.Name); Assert.IsNotNull(backgroundData.Configuration); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ClosingStructures/ClosingStructuresSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u -r560ea9f96409cc65f4666adf212a1c135c5e626f -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ClosingStructures/ClosingStructuresSectionResultEntityReadExtensionsTest.cs (.../ClosingStructuresSectionResultEntityReadExtensionsTest.cs) (revision 560ea9f96409cc65f4666adf212a1c135c5e626f) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ClosingStructures/ClosingStructuresSectionResultEntityReadExtensionsTest.cs (.../ClosingStructuresSectionResultEntityReadExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -24,6 +24,7 @@ using Application.Ringtoets.Storage.Read; using Application.Ringtoets.Storage.Read.ClosingStructures; using Application.Ringtoets.Storage.TestUtil; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.ClosingStructures.Data; using Ringtoets.Common.Data.FailureMechanism; @@ -64,15 +65,13 @@ } [Test] - [Combinatorial] - public void Read_ParameterValues_SectionResultWithParameterValues( - [Values(AssessmentLayerOneState.NotAssessed, AssessmentLayerOneState.NoVerdict, - AssessmentLayerOneState.Sufficient)] AssessmentLayerOneState layerOne, - [Values(AssessmentLayerTwoAResult.NotCalculated, AssessmentLayerTwoAResult.Failed, - AssessmentLayerTwoAResult.Successful)] AssessmentLayerTwoAResult layerTwoA, - [Values(0.1, 0.2, null)] double? layerThree) + public void Read_ParameterValues_SectionResultWithParameterValues() { // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + double layerThree = random.NextDouble(); + var collector = new ReadConversionCollector(); var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); @@ -89,13 +88,40 @@ entity.Read(sectionResult, collector); // Assert - Assert.IsNotNull(sectionResult); Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); - Assert.AreEqual(layerThree ?? double.NaN, sectionResult.AssessmentLayerThree, 1e-6); + Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6); Assert.IsNull(sectionResult.Calculation); } [Test] + public void Read_EntityWithNullValues_SectionResultWithNaNValues() + { + // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + + var collector = new ReadConversionCollector(); + + var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); + collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); + var entity = new ClosingStructuresSectionResultEntity + { + LayerThree = null, + LayerOne = Convert.ToByte(random.NextEnumValue()), + FailureMechanismSectionEntity = failureMechanismSectionEntity + }; + var sectionResult = new StructuresFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult, collector); + + // Assert + Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); + Assert.IsNaN(sectionResult.AssessmentLayerThree); + Assert.IsNull(sectionResult.Calculation); + } + + [Test] public void Read_CalculationEntitySet_ReturnClosingStructuresSectionResultWithCalculation() { // Setup Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/DuneErosion/DuneErosionSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/DuneErosion/DuneErosionSectionResultEntityReadExtensionsTest.cs (.../DuneErosionSectionResultEntityReadExtensionsTest.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/DuneErosion/DuneErosionSectionResultEntityReadExtensionsTest.cs (.../DuneErosionSectionResultEntityReadExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -24,6 +24,7 @@ using Application.Ringtoets.Storage.Read; using Application.Ringtoets.Storage.Read.DuneErosion; using Application.Ringtoets.Storage.TestUtil; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.DuneErosion.Data; @@ -48,15 +49,14 @@ } [Test] - [Combinatorial] - public void Read_ParameterValues_SectionResultWithParameterValues( - [Values(AssessmentLayerOneState.NotAssessed, AssessmentLayerOneState.NoVerdict, - AssessmentLayerOneState.Sufficient)] AssessmentLayerOneState layerOne, - [Values(AssessmentLayerTwoAResult.NotCalculated, AssessmentLayerTwoAResult.Failed, - AssessmentLayerTwoAResult.Successful)] AssessmentLayerTwoAResult layerTwoA, - [Values(0.1, 0.2, null)] double? layerThree) + public void Read_ParameterValues_SectionResultWithParameterValues() { // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + var layerTwoA = random.NextEnumValue(); + double layerThree = random.NextDouble(); + var collector = new ReadConversionCollector(); var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); @@ -76,8 +76,36 @@ // Assert Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); Assert.AreEqual(layerTwoA, sectionResult.AssessmentLayerTwoA); - Assert.AreEqual(layerThree ?? double.NaN, sectionResult.AssessmentLayerThree, 1e-6); - Assert.IsNotNull(sectionResult); + Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6); } + + [Test] + public void Read_EntityWithNullValues_SectionResultWithNaNValues() + { + var random = new Random(21); + var layerOne = random.NextEnumValue(); + var layerTwoA = random.NextEnumValue(); + + var collector = new ReadConversionCollector(); + + var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); + collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); + var entity = new DuneErosionSectionResultEntity + { + LayerOne = Convert.ToByte(layerOne), + LayerTwoA = Convert.ToByte(layerTwoA), + LayerThree = null, + FailureMechanismSectionEntity = failureMechanismSectionEntity + }; + var sectionResult = new DuneErosionFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult); + + // Assert + Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); + Assert.AreEqual(layerTwoA, sectionResult.AssessmentLayerTwoA); + Assert.IsNaN(sectionResult.AssessmentLayerThree); + } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u -rb6e0f8d41d92ed18c902138dd49cce6e703ee883 -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsSectionResultEntityReadExtensionsTest.cs (.../GrassCoverErosionInwardsSectionResultEntityReadExtensionsTest.cs) (revision b6e0f8d41d92ed18c902138dd49cce6e703ee883) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsSectionResultEntityReadExtensionsTest.cs (.../GrassCoverErosionInwardsSectionResultEntityReadExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -24,6 +24,7 @@ using Application.Ringtoets.Storage.Read; using Application.Ringtoets.Storage.Read.GrassCoverErosionInwards; using Application.Ringtoets.Storage.TestUtil; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.GrassCoverErosionInwards.Data; @@ -62,13 +63,13 @@ } [Test] - [Combinatorial] - public void Read_ParameterValues_SectionResultWithParameterValues( - [Values(AssessmentLayerOneState.NotAssessed, AssessmentLayerOneState.NoVerdict, - AssessmentLayerOneState.Sufficient)] AssessmentLayerOneState layerOne, - [Values(0.1, 0.2, null)] double? layerThree) + public void Read_ParameterValues_SectionResultWithParameterValues() { // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + double layerThree = random.NextDouble(); + var collector = new ReadConversionCollector(); var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); @@ -85,13 +86,41 @@ entity.Read(sectionResult, collector); // Assert - Assert.IsNotNull(sectionResult); Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); - Assert.AreEqual(layerThree ?? double.NaN, sectionResult.AssessmentLayerThree, 1e-6); + Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6); Assert.IsNull(sectionResult.Calculation); } [Test] + public void Read_EntityWithNullValues_SectionResultWithNaNValues() + { + // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + + var collector = new ReadConversionCollector(); + + var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); + collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); + + var entity = new GrassCoverErosionInwardsSectionResultEntity + { + LayerThree = null, + LayerOne = Convert.ToByte(layerOne), + FailureMechanismSectionEntity = failureMechanismSectionEntity + }; + var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult, collector); + + // Assert + Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); + Assert.IsNaN(sectionResult.AssessmentLayerThree); + Assert.IsNull(sectionResult.Calculation); + } + + [Test] public void Read_CalculationEntitySet_ReturnGrassCoverErosionInwardsSectionResultWithCalculation() { // Setup Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionOutwards/GrassCoverErosionOutwardsHydraulicLocationOutputEntityReadExtensionsTest.cs =================================================================== diff -u -r46d300b8932314e01403183fa15dc7f7cbdc7fd3 -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionOutwards/GrassCoverErosionOutwardsHydraulicLocationOutputEntityReadExtensionsTest.cs (.../GrassCoverErosionOutwardsHydraulicLocationOutputEntityReadExtensionsTest.cs) (revision 46d300b8932314e01403183fa15dc7f7cbdc7fd3) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionOutwards/GrassCoverErosionOutwardsHydraulicLocationOutputEntityReadExtensionsTest.cs (.../GrassCoverErosionOutwardsHydraulicLocationOutputEntityReadExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -48,13 +48,7 @@ } [Test] - [Combinatorial] - public void Read_ValidParameters_ReturnsHydraulicBoundaryLocationOutput( - [Values(HydraulicLocationOutputType.DesignWaterLevel, HydraulicLocationOutputType.WaveHeight)] - HydraulicLocationOutputType outputType, - [Values(CalculationConvergence.CalculatedNotConverged, CalculationConvergence.CalculatedConverged, - CalculationConvergence.NotCalculated)] - CalculationConvergence convergence) + public void Read_ValidParameters_ReturnsHydraulicBoundaryLocationOutput() { // Setup var random = new Random(22); @@ -63,6 +57,8 @@ double targetReliability = random.NextDouble(); double calculatedProbability = random.NextDouble(); double calculatedReliability = random.NextDouble(); + var convergence = random.NextEnumValue(); + var outputType = random.NextEnumValue(); var entity = new GrassCoverErosionOutwardsHydraulicLocationOutputEntity { HydraulicLocationOutputType = (byte) outputType, @@ -88,12 +84,12 @@ } [Test] - public void Read_NaNParameters_ReturnsHydraulicBoundaryLocationOutputWithNaN( - [Values(CalculationConvergence.CalculatedNotConverged, CalculationConvergence.CalculatedConverged, - CalculationConvergence.NotCalculated)] - CalculationConvergence convergence) + public void Read_NaNParameters_ReturnsHydraulicBoundaryLocationOutputWithNaN() { // Setup + var random = new Random(22); + var convergence = random.NextEnumValue(); + var entity = new GrassCoverErosionOutwardsHydraulicLocationOutputEntity { Result = double.NaN, Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionOutwards/GrassCoverErosionOutwardsSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionOutwards/GrassCoverErosionOutwardsSectionResultEntityReadExtensionsTest.cs (.../GrassCoverErosionOutwardsSectionResultEntityReadExtensionsTest.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionOutwards/GrassCoverErosionOutwardsSectionResultEntityReadExtensionsTest.cs (.../GrassCoverErosionOutwardsSectionResultEntityReadExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -24,6 +24,7 @@ using Application.Ringtoets.Storage.Read; using Application.Ringtoets.Storage.Read.GrassCoverErosionOutwards; using Application.Ringtoets.Storage.TestUtil; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.GrassCoverErosionOutwards.Data; @@ -48,15 +49,14 @@ } [Test] - [Combinatorial] - public void Read_ParameterValues_SectionResultWithParameterValues( - [Values(AssessmentLayerOneState.NotAssessed, AssessmentLayerOneState.NoVerdict, - AssessmentLayerOneState.Sufficient)] AssessmentLayerOneState layerOne, - [Values(AssessmentLayerTwoAResult.NotCalculated, AssessmentLayerTwoAResult.Failed, - AssessmentLayerTwoAResult.Successful)] AssessmentLayerTwoAResult layerTwoA, - [Values(0.1, 0.2, null)] double? layerThree) + public void Read_ParameterValues_SectionResultWithParameterValues() { // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + var layerTwoA = random.NextEnumValue(); + double layerThree = random.NextDouble(); + var collector = new ReadConversionCollector(); var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); @@ -74,10 +74,39 @@ entity.Read(sectionResult); // Assert - Assert.IsNotNull(sectionResult); Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); Assert.AreEqual(layerTwoA, sectionResult.AssessmentLayerTwoA); - Assert.AreEqual(layerThree ?? double.NaN, sectionResult.AssessmentLayerThree, 1e-6); + Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6); } + + [Test] + public void Read_EntityWithNullValues_SectionResultWithNaNValues() + { + // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + var layerTwoA = random.NextEnumValue(); + + var collector = new ReadConversionCollector(); + + var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); + collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); + var entity = new GrassCoverErosionOutwardsSectionResultEntity + { + LayerThree = null, + LayerTwoA = Convert.ToByte(layerTwoA), + LayerOne = Convert.ToByte(layerOne), + FailureMechanismSectionEntity = failureMechanismSectionEntity + }; + var sectionResult = new GrassCoverErosionOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult); + + // Assert + Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); + Assert.AreEqual(layerTwoA, sectionResult.AssessmentLayerTwoA); + Assert.IsNaN(sectionResult.AssessmentLayerThree); + } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverSlipOffInwardsSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverSlipOffInwardsSectionResultEntityReadExtensionsTest.cs (.../GrassCoverSlipOffInwardsSectionResultEntityReadExtensionsTest.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverSlipOffInwardsSectionResultEntityReadExtensionsTest.cs (.../GrassCoverSlipOffInwardsSectionResultEntityReadExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -23,6 +23,7 @@ using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Read; using Application.Ringtoets.Storage.TestUtil; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Integration.Data.StandAlone.SectionResults; @@ -47,15 +48,14 @@ } [Test] - [Combinatorial] - public void Read_ParameterValues_SectionResultWithParameterValues( - [Values(AssessmentLayerOneState.NotAssessed, AssessmentLayerOneState.NoVerdict, - AssessmentLayerOneState.Sufficient)] AssessmentLayerOneState layerOne, - [Values(AssessmentLayerTwoAResult.NotCalculated, AssessmentLayerTwoAResult.Failed, - AssessmentLayerTwoAResult.Successful)] AssessmentLayerTwoAResult layerTwoA, - [Values(0.1, 0.2, null)] double? layerThree) + public void Read_ParameterValues_SectionResultWithParameterValues() { // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + var layerTwoA = random.NextEnumValue(); + double layerThree = random.NextDouble(); + var collector = new ReadConversionCollector(); var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); @@ -73,10 +73,39 @@ entity.Read(sectionResult); // Assert - Assert.IsNotNull(sectionResult); Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); Assert.AreEqual(layerTwoA, sectionResult.AssessmentLayerTwoA); - Assert.AreEqual(layerThree ?? double.NaN, sectionResult.AssessmentLayerThree, 1e-6); + Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6); } + + [Test] + public void Read_EntityWithNullValues_SectionResultWithNaNValues() + { + // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + var layerTwoA = random.NextEnumValue(); + + var collector = new ReadConversionCollector(); + + var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); + collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); + var entity = new GrassCoverSlipOffInwardsSectionResultEntity + { + LayerThree = null, + LayerTwoA = Convert.ToByte(layerTwoA), + LayerOne = Convert.ToByte(layerOne), + FailureMechanismSectionEntity = failureMechanismSectionEntity + }; + var sectionResult = new GrassCoverSlipOffInwardsFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult); + + // Assert + Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); + Assert.AreEqual(layerTwoA, sectionResult.AssessmentLayerTwoA); + Assert.IsNaN(sectionResult.AssessmentLayerThree); + } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverSlipOffOutwardsSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverSlipOffOutwardsSectionResultEntityReadExtensionsTest.cs (.../GrassCoverSlipOffOutwardsSectionResultEntityReadExtensionsTest.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverSlipOffOutwardsSectionResultEntityReadExtensionsTest.cs (.../GrassCoverSlipOffOutwardsSectionResultEntityReadExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -23,6 +23,7 @@ using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Read; using Application.Ringtoets.Storage.TestUtil; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Integration.Data.StandAlone.SectionResults; @@ -47,15 +48,14 @@ } [Test] - [Combinatorial] - public void Read_ParameterValues_SectionResultWithParameterValues( - [Values(AssessmentLayerOneState.NotAssessed, AssessmentLayerOneState.NoVerdict, - AssessmentLayerOneState.Sufficient)] AssessmentLayerOneState layerOne, - [Values(AssessmentLayerTwoAResult.NotCalculated, AssessmentLayerTwoAResult.Failed, - AssessmentLayerTwoAResult.Successful)] AssessmentLayerTwoAResult layerTwoA, - [Values(1.1, 2.2, null)] double? layerThree) + public void Read_ParameterValues_SectionResultWithParameterValues() { // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + var layerTwoA = random.NextEnumValue(); + double layerThree = random.NextDouble(); + var collector = new ReadConversionCollector(); var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); @@ -76,7 +76,38 @@ Assert.IsNotNull(sectionResult); Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); Assert.AreEqual(layerTwoA, sectionResult.AssessmentLayerTwoA); - Assert.AreEqual(layerThree ?? double.NaN, sectionResult.AssessmentLayerThree, 1e-6); + Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6); } + + [Test] + public void Read_EntityWithNullValues_SectionResultWithNaNValues() + { + // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + var layerTwoA = random.NextEnumValue(); + + var collector = new ReadConversionCollector(); + + var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); + collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); + var entity = new GrassCoverSlipOffOutwardsSectionResultEntity + { + LayerThree = null, + LayerTwoA = Convert.ToByte(layerTwoA), + LayerOne = Convert.ToByte(layerOne), + FailureMechanismSectionEntity = failureMechanismSectionEntity + }; + var sectionResult = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult); + + // Assert + Assert.IsNotNull(sectionResult); + Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); + Assert.AreEqual(layerTwoA, sectionResult.AssessmentLayerTwoA); + Assert.IsNaN(sectionResult.AssessmentLayerThree); + } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/HeightStructures/HeightStructuresSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u -ra23cff5445d53b381fd72f50a0d9b6c200cbcd69 -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/HeightStructures/HeightStructuresSectionResultEntityReadExtensionsTest.cs (.../HeightStructuresSectionResultEntityReadExtensionsTest.cs) (revision a23cff5445d53b381fd72f50a0d9b6c200cbcd69) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/HeightStructures/HeightStructuresSectionResultEntityReadExtensionsTest.cs (.../HeightStructuresSectionResultEntityReadExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -24,6 +24,7 @@ using Application.Ringtoets.Storage.Read; using Application.Ringtoets.Storage.Read.HeightStructures; using Application.Ringtoets.Storage.TestUtil; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Structures; @@ -64,15 +65,13 @@ } [Test] - [Combinatorial] - public void Read_ParameterValues_SectionResultWithParameterValues( - [Values(AssessmentLayerOneState.NotAssessed, AssessmentLayerOneState.NoVerdict, - AssessmentLayerOneState.Sufficient)] AssessmentLayerOneState layerOne, - [Values(AssessmentLayerTwoAResult.NotCalculated, AssessmentLayerTwoAResult.Failed, - AssessmentLayerTwoAResult.Successful)] AssessmentLayerTwoAResult layerTwoA, - [Values(0.1, 0.2, null)] double? layerThree) + public void Read_ParameterValues_SectionResultWithParameterValues() { // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + double layerThree = random.NextDouble(); + var collector = new ReadConversionCollector(); var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); @@ -90,12 +89,39 @@ // Assert Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); - Assert.AreEqual(layerThree ?? double.NaN, sectionResult.AssessmentLayerThree, 1e-6); - Assert.IsNotNull(sectionResult); + Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6); Assert.IsNull(sectionResult.Calculation); } [Test] + public void Read_EntityWithNullValues_SectionResultWithNaNValues() + { + // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + + var collector = new ReadConversionCollector(); + + var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); + collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); + var entity = new HeightStructuresSectionResultEntity + { + LayerOne = Convert.ToByte(layerOne), + LayerThree = null, + FailureMechanismSectionEntity = failureMechanismSectionEntity + }; + var sectionResult = new StructuresFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult, collector); + + // Assert + Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); + Assert.IsNaN(sectionResult.AssessmentLayerThree); + Assert.IsNull(sectionResult.Calculation); + } + + [Test] public void Read_CalculationEntitySet_ReturnHeightStructuresSectionResultWithCalculation() { // Setup Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/HydraulicLocationOutputEntityReadExtensionsTest.cs =================================================================== diff -u -r46d300b8932314e01403183fa15dc7f7cbdc7fd3 -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/HydraulicLocationOutputEntityReadExtensionsTest.cs (.../HydraulicLocationOutputEntityReadExtensionsTest.cs) (revision 46d300b8932314e01403183fa15dc7f7cbdc7fd3) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/HydraulicLocationOutputEntityReadExtensionsTest.cs (.../HydraulicLocationOutputEntityReadExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -24,7 +24,6 @@ using System.Linq; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Read; -using Core.Common.Base.Data; using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.Hydraulics; @@ -48,11 +47,7 @@ } [Test] - [Combinatorial] - public void Read_ValidParameters_ReturnsHydraulicBoundaryLocationOutput( - [Values(HydraulicLocationOutputType.DesignWaterLevel, HydraulicLocationOutputType.WaveHeight)] HydraulicLocationOutputType outputType, - [Values(CalculationConvergence.CalculatedNotConverged, CalculationConvergence.CalculatedConverged, - CalculationConvergence.NotCalculated)] CalculationConvergence convergence) + public void Read_ValidParameters_ReturnsHydraulicBoundaryLocationOutput() { // Setup var random = new Random(22); @@ -61,6 +56,7 @@ double targetReliability = random.NextDouble(); double calculatedProbability = random.NextDouble(); double calculatedReliability = random.NextDouble(); + var convergence = random.NextEnumValue(); var entity = new HydraulicLocationOutputEntity { Result = result, @@ -85,11 +81,12 @@ } [Test] - public void Read_NaNParameters_ReturnsHydraulicBoundaryLocationOutputWithNaN( - [Values(CalculationConvergence.CalculatedNotConverged, CalculationConvergence.CalculatedConverged, - CalculationConvergence.NotCalculated)] CalculationConvergence convergence) + public void Read_NaNParameters_ReturnsHydraulicBoundaryLocationOutputWithNaN() { // Setup + var random = new Random(21); + var convergence = random.NextEnumValue(); + var entity = new HydraulicLocationOutputEntity { Result = double.NaN, Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityOutwards/MacroStabilityOutwardsSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u -r36d4b4090a4169cc8d25ede0029a3244df8fe74d -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityOutwards/MacroStabilityOutwardsSectionResultEntityReadExtensionsTest.cs (.../MacroStabilityOutwardsSectionResultEntityReadExtensionsTest.cs) (revision 36d4b4090a4169cc8d25ede0029a3244df8fe74d) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityOutwards/MacroStabilityOutwardsSectionResultEntityReadExtensionsTest.cs (.../MacroStabilityOutwardsSectionResultEntityReadExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -21,9 +21,10 @@ using System; using Application.Ringtoets.Storage.DbContext; -using Application.Ringtoets.Storage.Read.MacroStabilityOutwards; using Application.Ringtoets.Storage.Read; +using Application.Ringtoets.Storage.Read.MacroStabilityOutwards; using Application.Ringtoets.Storage.TestUtil; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Integration.Data.StandAlone.SectionResults; @@ -48,15 +49,14 @@ } [Test] - [Combinatorial] - public void Read_ParameterValues_SectionResultWithParameterValues( - [Values(AssessmentLayerOneState.NotAssessed, AssessmentLayerOneState.NoVerdict, - AssessmentLayerOneState.Sufficient)] - AssessmentLayerOneState layerOne, - [Values(0.1, 0.2, null)] double? layerTwoA, - [Values(0.11, 0.22, null)] double? layerThree) + public void Read_ParameterValues_SectionResultWithParameterValues() { // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + double layerTwoA = random.NextDouble(); + double layerThree = random.NextDouble(); + var collector = new ReadConversionCollector(); var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); @@ -74,10 +74,38 @@ entity.Read(sectionResult); // Assert - Assert.IsNotNull(sectionResult); Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); - Assert.AreEqual(layerTwoA ?? double.NaN, sectionResult.AssessmentLayerTwoA, 1e-6); - Assert.AreEqual(layerThree ?? double.NaN, sectionResult.AssessmentLayerThree, 1e-6); + Assert.AreEqual(layerTwoA, sectionResult.AssessmentLayerTwoA, 1e-6); + Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6); } + + [Test] + public void Read_EntityWithNullValues_SectionResultWithNaNValues() + { + // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + + var collector = new ReadConversionCollector(); + + var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); + collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); + var entity = new MacroStabilityOutwardsSectionResultEntity + { + LayerThree = null, + LayerTwoA = null, + LayerOne = Convert.ToByte(layerOne), + FailureMechanismSectionEntity = failureMechanismSectionEntity + }; + var sectionResult = new MacroStabilityOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult); + + // Assert + Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); + Assert.IsNaN(sectionResult.AssessmentLayerTwoA); + Assert.IsNaN(sectionResult.AssessmentLayerThree); + } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MicrostabilitySectionResultEntityReadExtensionsTest.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MicrostabilitySectionResultEntityReadExtensionsTest.cs (.../MicrostabilitySectionResultEntityReadExtensionsTest.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MicrostabilitySectionResultEntityReadExtensionsTest.cs (.../MicrostabilitySectionResultEntityReadExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -23,6 +23,7 @@ using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Read; using Application.Ringtoets.Storage.TestUtil; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Integration.Data.StandAlone.SectionResults; @@ -47,15 +48,14 @@ } [Test] - [Combinatorial] - public void Read_ParameterValues_SectionResultWithParameterValues( - [Values(AssessmentLayerOneState.NotAssessed, AssessmentLayerOneState.NoVerdict, - AssessmentLayerOneState.Sufficient)] AssessmentLayerOneState layerOne, - [Values(AssessmentLayerTwoAResult.NotCalculated, AssessmentLayerTwoAResult.Failed, - AssessmentLayerTwoAResult.Successful)] AssessmentLayerTwoAResult layerTwoA, - [Values(0.1, 0.2, null)] double? layerThree) + public void Read_ParameterValues_SectionResultWithParameterValues() { // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + var layerTwoA = random.NextEnumValue(); + double layerThree = random.NextDouble(); + var collector = new ReadConversionCollector(); var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); @@ -73,10 +73,39 @@ entity.Read(sectionResult); // Assert - Assert.IsNotNull(sectionResult); Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); Assert.AreEqual(layerTwoA, sectionResult.AssessmentLayerTwoA); - Assert.AreEqual(layerThree ?? double.NaN, sectionResult.AssessmentLayerThree, 1e-6); + Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6); } + + [Test] + public void Read_EntityWithNullValues_SectionResultWitNaNValues() + { + // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + var layerTwoA = random.NextEnumValue(); + + var collector = new ReadConversionCollector(); + + var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); + collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); + var entity = new MicrostabilitySectionResultEntity + { + LayerThree = null, + LayerTwoA = Convert.ToByte(layerTwoA), + LayerOne = Convert.ToByte(layerOne), + FailureMechanismSectionEntity = failureMechanismSectionEntity + }; + var sectionResult = new MicrostabilityFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult); + + // Assert + Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); + Assert.AreEqual(layerTwoA, sectionResult.AssessmentLayerTwoA); + Assert.IsNaN(sectionResult.AssessmentLayerThree); + } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u -rb6e0f8d41d92ed18c902138dd49cce6e703ee883 -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingSectionResultEntityReadExtensionsTest.cs (.../PipingSectionResultEntityReadExtensionsTest.cs) (revision b6e0f8d41d92ed18c902138dd49cce6e703ee883) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingSectionResultEntityReadExtensionsTest.cs (.../PipingSectionResultEntityReadExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -24,6 +24,7 @@ using Application.Ringtoets.Storage.Read; using Application.Ringtoets.Storage.Read.Piping; using Application.Ringtoets.Storage.TestUtil; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Piping.Data; @@ -48,15 +49,13 @@ } [Test] - [Combinatorial] - public void Read_ParameterValues_SectionResultWithParameterValues( - [Values(AssessmentLayerOneState.NotAssessed, AssessmentLayerOneState.NoVerdict, - AssessmentLayerOneState.Sufficient)] AssessmentLayerOneState layerOne, - [Values(AssessmentLayerTwoAResult.NotCalculated, AssessmentLayerTwoAResult.Failed, - AssessmentLayerTwoAResult.Successful)] AssessmentLayerTwoAResult layerTwoA, - [Values(0.1, 0.2, null)] double? layerThree) + public void Read_ParameterValues_SectionResultWithParameterValues() { // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + double layerThree = random.NextDouble(); + var collector = new ReadConversionCollector(); var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); @@ -74,9 +73,36 @@ entity.Read(sectionResult); // Assert - Assert.IsNotNull(sectionResult); Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); - Assert.AreEqual(layerThree ?? double.NaN, sectionResult.AssessmentLayerThree, 1e-6); + Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6); } + + [Test] + public void Read_EntityWithNullValues_SectionResultWithNaNValues() + { + // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + + var collector = new ReadConversionCollector(); + + var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); + collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); + var entity = new PipingSectionResultEntity + { + LayerThree = null, + LayerOne = Convert.ToByte(layerOne), + FailureMechanismSectionEntity = failureMechanismSectionEntity + }; + + var sectionResult = new PipingFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult); + + // Assert + Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); + Assert.IsNaN(sectionResult.AssessmentLayerThree); + } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/PipingStructures/PipingStructureSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/PipingStructures/PipingStructureSectionResultEntityReadExtensionsTest.cs (.../PipingStructureSectionResultEntityReadExtensionsTest.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/PipingStructures/PipingStructureSectionResultEntityReadExtensionsTest.cs (.../PipingStructureSectionResultEntityReadExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -24,6 +24,7 @@ using Application.Ringtoets.Storage.Read; using Application.Ringtoets.Storage.Read.PipingStructures; using Application.Ringtoets.Storage.TestUtil; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Integration.Data.StandAlone.SectionResults; @@ -48,15 +49,14 @@ } [Test] - [Combinatorial] - public void Read_ParameterValues_SectionResultWithParameterValues( - [Values(AssessmentLayerOneState.NotAssessed, AssessmentLayerOneState.NoVerdict, - AssessmentLayerOneState.Sufficient)] AssessmentLayerOneState layerOne, - [Values(AssessmentLayerTwoAResult.NotCalculated, AssessmentLayerTwoAResult.Failed, - AssessmentLayerTwoAResult.Successful)] AssessmentLayerTwoAResult layerTwoA, - [Values(1.1, 2.2, null)] double? layerThree) + public void Read_ParameterValues_SectionResultWithParameterValues() { // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + var layerTwoA = random.NextEnumValue(); + double layerThree = random.NextDouble(); + var collector = new ReadConversionCollector(); var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); @@ -77,7 +77,38 @@ Assert.IsNotNull(sectionResult); Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); Assert.AreEqual(layerTwoA, sectionResult.AssessmentLayerTwoA); - Assert.AreEqual(layerThree ?? double.NaN, sectionResult.AssessmentLayerThree, 1e-6); + Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6); } + + [Test] + public void Read_EntityWithNullValues_SectionResultWithNaNValues() + { + // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + var layerTwoA = random.NextEnumValue(); + + var collector = new ReadConversionCollector(); + + var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); + collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); + var entity = new PipingStructureSectionResultEntity + { + LayerThree = null, + LayerTwoA = Convert.ToByte(layerTwoA), + LayerOne = Convert.ToByte(layerOne), + FailureMechanismSectionEntity = failureMechanismSectionEntity + }; + var sectionResult = new PipingStructureFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult); + + // Assert + Assert.IsNotNull(sectionResult); + Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); + Assert.AreEqual(layerTwoA, sectionResult.AssessmentLayerTwoA); + Assert.IsNaN(sectionResult.AssessmentLayerThree); + } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityPointStructures/StabilityPointStructuresSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u -r56246f10e7876b30f36a5b9709ec2e3332b4010a -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityPointStructures/StabilityPointStructuresSectionResultEntityReadExtensionsTest.cs (.../StabilityPointStructuresSectionResultEntityReadExtensionsTest.cs) (revision 56246f10e7876b30f36a5b9709ec2e3332b4010a) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityPointStructures/StabilityPointStructuresSectionResultEntityReadExtensionsTest.cs (.../StabilityPointStructuresSectionResultEntityReadExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -24,6 +24,7 @@ using Application.Ringtoets.Storage.Read; using Application.Ringtoets.Storage.Read.StabilityPointStructures; using Application.Ringtoets.Storage.TestUtil; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Structures; @@ -64,13 +65,13 @@ } [Test] - [Combinatorial] - public void Read_ParameterValues_SectionResultWithParameterValues( - [Values(AssessmentLayerOneState.NotAssessed, AssessmentLayerOneState.NoVerdict, - AssessmentLayerOneState.Sufficient)] AssessmentLayerOneState layerOne, - [Values(0.1, 0.2, null)] double? layerThree) + public void Read_ParameterValues_SectionResultWithParameterValues() { // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + double layerThree = random.NextDouble(); + var collector = new ReadConversionCollector(); var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); @@ -88,12 +89,39 @@ // Assert Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); - Assert.AreEqual(layerThree ?? double.NaN, sectionResult.AssessmentLayerThree, 1e-6); - Assert.IsNotNull(sectionResult); + Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6); Assert.IsNull(sectionResult.Calculation); } [Test] + public void Read_EntityWithNullValues_SectionResultWithNaNValues() + { + // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + + var collector = new ReadConversionCollector(); + + var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); + collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); + var entity = new StabilityPointStructuresSectionResultEntity + { + LayerOne = Convert.ToByte(layerOne), + LayerThree = null, + FailureMechanismSectionEntity = failureMechanismSectionEntity + }; + var sectionResult = new StructuresFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult, collector); + + // Assert + Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); + Assert.IsNaN(sectionResult.AssessmentLayerThree); + Assert.IsNull(sectionResult.Calculation); + } + + [Test] public void Read_CalculationEntitySet_ReturnStabilityPointStructuresSectionResultWithCalculation() { // Setup Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityStoneCover/StabilityStoneCoverSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityStoneCover/StabilityStoneCoverSectionResultEntityReadExtensionsTest.cs (.../StabilityStoneCoverSectionResultEntityReadExtensionsTest.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityStoneCover/StabilityStoneCoverSectionResultEntityReadExtensionsTest.cs (.../StabilityStoneCoverSectionResultEntityReadExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -24,6 +24,7 @@ using Application.Ringtoets.Storage.Read; using Application.Ringtoets.Storage.Read.StabilityStoneCover; using Application.Ringtoets.Storage.TestUtil; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.StabilityStoneCover.Data; @@ -48,15 +49,14 @@ } [Test] - [Combinatorial] - public void Read_ParameterValues_SectionResultWithParameterValues( - [Values(AssessmentLayerOneState.NotAssessed, AssessmentLayerOneState.NoVerdict, - AssessmentLayerOneState.Sufficient)] AssessmentLayerOneState layerOne, - [Values(AssessmentLayerTwoAResult.NotCalculated, AssessmentLayerTwoAResult.Failed, - AssessmentLayerTwoAResult.Successful)] AssessmentLayerTwoAResult layerTwoA, - [Values(0.1, 0.2, null)] double? layerThree) + public void Read_ParameterValues_SectionResultWithParameterValues() { // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + var layerTwoA = random.NextEnumValue(); + double layerThree = random.NextDouble(); + var collector = new ReadConversionCollector(); var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); @@ -76,8 +76,37 @@ // Assert Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); Assert.AreEqual(layerTwoA, sectionResult.AssessmentLayerTwoA); - Assert.AreEqual(layerThree ?? double.NaN, sectionResult.AssessmentLayerThree, 1e-6); - Assert.IsNotNull(sectionResult); + Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6); } + + [Test] + public void Read_EntityWithNull_SectionResultWithNaNValues() + { + // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + var layerTwoA = random.NextEnumValue(); + + var collector = new ReadConversionCollector(); + + var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); + collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); + var entity = new StabilityStoneCoverSectionResultEntity + { + LayerOne = Convert.ToByte(layerOne), + LayerTwoA = Convert.ToByte(layerTwoA), + LayerThree = null, + FailureMechanismSectionEntity = failureMechanismSectionEntity + }; + var sectionResult = new StabilityStoneCoverFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult); + + // Assert + Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); + Assert.AreEqual(layerTwoA, sectionResult.AssessmentLayerTwoA); + Assert.IsNaN(sectionResult.AssessmentLayerThree); + } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StrengthStabilityLengthwiseConstructionSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StrengthStabilityLengthwiseConstructionSectionResultEntityReadExtensionsTest.cs (.../StrengthStabilityLengthwiseConstructionSectionResultEntityReadExtensionsTest.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StrengthStabilityLengthwiseConstructionSectionResultEntityReadExtensionsTest.cs (.../StrengthStabilityLengthwiseConstructionSectionResultEntityReadExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -23,6 +23,7 @@ using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Read; using Application.Ringtoets.Storage.TestUtil; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Integration.Data.StandAlone.SectionResults; @@ -47,13 +48,13 @@ } [Test] - [Combinatorial] - public void Read_ParameterValues_SectionResultWithParameterValues( - [Values(AssessmentLayerOneState.NotAssessed, AssessmentLayerOneState.NoVerdict, - AssessmentLayerOneState.Sufficient)] AssessmentLayerOneState layerOne, - [Values(0.1, 0.2, null)] double? layerThree) + public void Read_ParameterValues_SectionResultWithParameterValues() { // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + double layerThree = random.NextDouble(); + var collector = new ReadConversionCollector(); var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); @@ -72,7 +73,35 @@ // Assert Assert.IsNotNull(sectionResult); Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); - Assert.AreEqual(layerThree ?? double.NaN, sectionResult.AssessmentLayerThree, 1e-6); + Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6); } + + [Test] + public void Read_EntityWithNullValues_SectionResultWithNaNValues() + { + // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + + var collector = new ReadConversionCollector(); + + var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); + collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); + var entity = new StrengthStabilityLengthwiseConstructionSectionResultEntity + { + LayerThree = null, + LayerOne = Convert.ToByte(layerOne), + FailureMechanismSectionEntity = failureMechanismSectionEntity + }; + var sectionResult = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult); + + // Assert + Assert.IsNotNull(sectionResult); + Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); + Assert.IsNaN(sectionResult.AssessmentLayerThree); + } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/TechnicalInnovationSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/TechnicalInnovationSectionResultEntityReadExtensionsTest.cs (.../TechnicalInnovationSectionResultEntityReadExtensionsTest.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/TechnicalInnovationSectionResultEntityReadExtensionsTest.cs (.../TechnicalInnovationSectionResultEntityReadExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -23,6 +23,7 @@ using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Read; using Application.Ringtoets.Storage.TestUtil; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Integration.Data.StandAlone.SectionResults; @@ -47,13 +48,13 @@ } [Test] - [Combinatorial] - public void Read_ParameterValues_SectionResultWithParameterValues( - [Values(AssessmentLayerOneState.NotAssessed, AssessmentLayerOneState.NoVerdict, - AssessmentLayerOneState.Sufficient)] AssessmentLayerOneState layerOne, - [Values(0.1, 0.2, null)] double? layerThree) + public void Read_ParameterValues_SectionResultWithParameterValues() { // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + double layerThree = random.NextDouble(); + var collector = new ReadConversionCollector(); var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); @@ -72,7 +73,35 @@ // Assert Assert.IsNotNull(sectionResult); Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); - Assert.AreEqual(layerThree ?? double.NaN, sectionResult.AssessmentLayerThree, 1e-6); + Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6); } + + [Test] + public void Read_EntityWithNullValues_SectionResultWithNaNValues() + { + // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + + var collector = new ReadConversionCollector(); + + var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); + collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); + var entity = new TechnicalInnovationSectionResultEntity + { + LayerThree = null, + LayerOne = Convert.ToByte(layerOne), + FailureMechanismSectionEntity = failureMechanismSectionEntity + }; + var sectionResult = new TechnicalInnovationFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult); + + // Assert + Assert.IsNotNull(sectionResult); + Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); + Assert.IsNaN(sectionResult.AssessmentLayerThree); + } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/WaterPressureAsphaltCoverSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/WaterPressureAsphaltCoverSectionResultEntityReadExtensionsTest.cs (.../WaterPressureAsphaltCoverSectionResultEntityReadExtensionsTest.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/WaterPressureAsphaltCoverSectionResultEntityReadExtensionsTest.cs (.../WaterPressureAsphaltCoverSectionResultEntityReadExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -23,6 +23,7 @@ using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Read; using Application.Ringtoets.Storage.TestUtil; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Integration.Data.StandAlone.SectionResults; @@ -47,13 +48,13 @@ } [Test] - [Combinatorial] - public void Read_ParameterValues_SectionResultWithParameterValues( - [Values(AssessmentLayerOneState.NotAssessed, AssessmentLayerOneState.NoVerdict, - AssessmentLayerOneState.Sufficient)] AssessmentLayerOneState layerOne, - [Values(0.1, 0.2, null)] double? layerThree) + public void Read_ParameterValues_SectionResultWithParameterValues() { // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + double layerThree = random.NextDouble(); + var collector = new ReadConversionCollector(); var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); @@ -72,7 +73,35 @@ // Assert Assert.IsNotNull(sectionResult); Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); - Assert.AreEqual(layerThree ?? double.NaN, sectionResult.AssessmentLayerThree, 1e-6); + Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6); } + + [Test] + public void Read_EntityWithNullValues_SectionResultWithNaNValues() + { + // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + + var collector = new ReadConversionCollector(); + + var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); + collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); + var entity = new WaterPressureAsphaltCoverSectionResultEntity + { + LayerThree = null, + LayerOne = Convert.ToByte(layerOne), + FailureMechanismSectionEntity = failureMechanismSectionEntity + }; + var sectionResult = new WaterPressureAsphaltCoverFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult); + + // Assert + Assert.IsNotNull(sectionResult); + Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); + Assert.IsNaN(sectionResult.AssessmentLayerThree); + } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/WaveImpactAsphaltCover/WaveImpactAsphaltCoverSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -rb8df616ca911988b921b933bead5f1ef6862d076 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/WaveImpactAsphaltCover/WaveImpactAsphaltCoverSectionResultEntityReadExtensionsTest.cs (.../WaveImpactAsphaltCoverSectionResultEntityReadExtensionsTest.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/WaveImpactAsphaltCover/WaveImpactAsphaltCoverSectionResultEntityReadExtensionsTest.cs (.../WaveImpactAsphaltCoverSectionResultEntityReadExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) @@ -24,6 +24,7 @@ using Application.Ringtoets.Storage.Read; using Application.Ringtoets.Storage.Read.WaveImpactAsphaltCover; using Application.Ringtoets.Storage.TestUtil; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.WaveImpactAsphaltCover.Data; @@ -48,15 +49,14 @@ } [Test] - [Combinatorial] - public void Read_ParameterValues_SectionResultWithParameterValues( - [Values(AssessmentLayerOneState.NotAssessed, AssessmentLayerOneState.NoVerdict, - AssessmentLayerOneState.Sufficient)] AssessmentLayerOneState layerOne, - [Values(AssessmentLayerTwoAResult.Failed, AssessmentLayerTwoAResult.NotCalculated, - AssessmentLayerTwoAResult.Successful)] AssessmentLayerTwoAResult layerTwoA, - [Values(0.11, 0.22, null)] double? layerThree) + public void Read_ParameterValues_SectionResultWithParameterValues() { // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + var layerTwoA = random.NextEnumValue(); + double layerThree = random.NextDouble(); + var collector = new ReadConversionCollector(); var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); @@ -74,10 +74,39 @@ entity.Read(sectionResult); // Assert - Assert.IsNotNull(sectionResult); Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); Assert.AreEqual(layerTwoA, sectionResult.AssessmentLayerTwoA); - Assert.AreEqual(layerThree ?? double.NaN, sectionResult.AssessmentLayerThree, 1e-6); + Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6); } + + [Test] + public void Read_EntityWithNullValues_SectionResultWithNaNValues() + { + // Setup + var random = new Random(21); + var layerOne = random.NextEnumValue(); + var layerTwoA = random.NextEnumValue(); + + var collector = new ReadConversionCollector(); + + var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); + collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); + var entity = new WaveImpactAsphaltCoverSectionResultEntity + { + LayerThree = null, + LayerTwoA = Convert.ToByte(layerTwoA), + LayerOne = Convert.ToByte(layerOne), + FailureMechanismSectionEntity = failureMechanismSectionEntity + }; + var sectionResult = new WaveImpactAsphaltCoverFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult); + + // Assert + Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); + Assert.AreEqual(layerTwoA, sectionResult.AssessmentLayerTwoA); + Assert.IsNaN(sectionResult.AssessmentLayerThree); + } } } \ No newline at end of file