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