Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacrostabilityOutwardsSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u -re38a7c2baca2872af6319d535c6468133ea31fbc -r01782033c49f0510e5a622c161c14fa8e7a56138 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacrostabilityOutwardsSectionResultEntityReadExtensionsTest.cs (.../MacrostabilityOutwardsSectionResultEntityReadExtensionsTest.cs) (revision e38a7c2baca2872af6319d535c6468133ea31fbc) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacrostabilityOutwardsSectionResultEntityReadExtensionsTest.cs (.../MacrostabilityOutwardsSectionResultEntityReadExtensionsTest.cs) (revision 01782033c49f0510e5a622c161c14fa8e7a56138) @@ -47,16 +47,13 @@ } [Test] - [TestCase(AssessmentLayerOneState.NotAssessed)] - [TestCase(AssessmentLayerOneState.NeedsDetailedAssessment)] - [TestCase(AssessmentLayerOneState.Sufficient)] - public void Read_WithDecimalParameterValues_ReturnMacrostabilityOutwardsSectionResultWithDoubleParameterValues( - AssessmentLayerOneState layerOne) + public void Read_ParameterValues_SectionResultWithParameterValues( + [Values(AssessmentLayerOneState.NotAssessed, AssessmentLayerOneState.NeedsDetailedAssessment, + AssessmentLayerOneState.Sufficient)] AssessmentLayerOneState layerOne, + [Values(0.1, 0.2, null)] double? layerTwoA, + [Values(0.11, 0.22, null)] double? layerThree) { // Setup - var random = new Random(21); - double layerThree = random.NextDouble(); - double layerTwoA = random.NextDouble(); var collector = new ReadConversionCollector(); var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); @@ -76,60 +73,8 @@ // Assert Assert.IsNotNull(sectionResult); Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); - Assert.AreEqual(layerTwoA, sectionResult.AssessmentLayerTwoA, 1e-6); - Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6); + Assert.AreEqual(layerTwoA ?? double.NaN, sectionResult.AssessmentLayerTwoA, 1e-6); + Assert.AreEqual(layerThree ?? double.NaN, sectionResult.AssessmentLayerThree, 1e-6); } - - [Test] - [TestCase(AssessmentLayerOneState.NotAssessed)] - [TestCase(AssessmentLayerOneState.NeedsDetailedAssessment)] - [TestCase(AssessmentLayerOneState.Sufficient)] - public void Read_WithNullLayerTwoA_ReturnMacrostabilityOutwardsSectionResultWithNullParameters( - AssessmentLayerOneState layerOne) - { - // Setup - var collector = new ReadConversionCollector(); - var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); - collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); - var entity = new MacrostabilityOutwardsSectionResultEntity - { - LayerOne = Convert.ToByte(layerOne), - LayerTwoA = null, - LayerThree = new Random(21).NextDouble(), - FailureMechanismSectionEntity = failureMechanismSectionEntity - }; - var sectionResult = new MacrostabilityOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection()); - - // Call - entity.Read(sectionResult); - - // Assert - Assert.IsNaN(sectionResult.AssessmentLayerTwoA); - } - - [Test] - [TestCase(true)] - [TestCase(false)] - public void Read_WithNullLayerThree_ReturnMacrostabilityOutwardsSectionResultWithNullParameters(bool layerOne) - { - // Setup - var collector = new ReadConversionCollector(); - var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); - collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); - var entity = new MacrostabilityOutwardsSectionResultEntity - { - LayerOne = Convert.ToByte(layerOne), - LayerTwoA = new Random(21).NextDouble(), - LayerThree = null, - FailureMechanismSectionEntity = failureMechanismSectionEntity - }; - var sectionResult = new MacrostabilityOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection()); - - // Call - entity.Read(sectionResult); - - // Assert - Assert.IsNaN(sectionResult.AssessmentLayerThree); - } } } \ No newline at end of file