Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/HeightStructuresSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u -re0ef393f7069a18d7e160aceaf91f603dfc8c5ae -r838250fef0c200dbbffa9a562ca5935fdc500d19 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/HeightStructuresSectionResultEntityReadExtensionsTest.cs (.../HeightStructuresSectionResultEntityReadExtensionsTest.cs) (revision e0ef393f7069a18d7e160aceaf91f603dfc8c5ae) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/HeightStructuresSectionResultEntityReadExtensionsTest.cs (.../HeightStructuresSectionResultEntityReadExtensionsTest.cs) (revision 838250fef0c200dbbffa9a562ca5935fdc500d19) @@ -24,6 +24,7 @@ using Application.Ringtoets.Storage.Read; using Application.Ringtoets.Storage.TestUtil; using NUnit.Framework; +using Ringtoets.HeightStructures.Data; namespace Application.Ringtoets.Storage.Test.Read { @@ -37,14 +38,28 @@ var entity = new HeightStructuresSectionResultEntity(); // Call - TestDelegate call = () => entity.Read(null); + TestDelegate call = () => entity.Read(new HeightStructuresFailureMechanismSectionResult(new TestFailureMechanismSection()), null); // Assert string paramName = Assert.Throws(call).ParamName; Assert.AreEqual("collector", paramName); } [Test] + public void Read_SectionResultIsNull_ThrowArgumentNullException() + { + // Setup + var entity = new ClosingStructureSectionResultEntity(); + + // Call + TestDelegate call = () => entity.Read(null, new ReadConversionCollector()); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("sectionResult", paramName); + } + + [Test] [TestCase(true)] [TestCase(false)] public void Read_WithDecimalParameterValues_ReturnHeightStructuresSoilLayerWithDoubleParameterValues(bool layerOne) @@ -64,15 +79,16 @@ LayerOne = Convert.ToByte(layerOne), FailureMechanismSectionEntity = failureMechanismSectionEntity }; + var sectionResult = new HeightStructuresFailureMechanismSectionResult(new TestFailureMechanismSection()); // Call - var result = entity.Read(collector); + entity.Read(sectionResult, collector); // Assert - Assert.IsNotNull(result); - Assert.AreEqual(entityId, result.StorageId); - Assert.AreEqual(layerOne, result.AssessmentLayerOne); - Assert.AreEqual(layerThree, result.AssessmentLayerThree, 1e-6); + Assert.IsNotNull(sectionResult); + Assert.AreEqual(entityId, sectionResult.StorageId); + Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); + Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6); } [Test] @@ -90,12 +106,13 @@ LayerThree = null, FailureMechanismSectionEntity = failureMechanismSectionEntity }; + var sectionResult = new HeightStructuresFailureMechanismSectionResult(new TestFailureMechanismSection()); // Call - var layer = entity.Read(collector); + entity.Read(sectionResult, collector); // Assert - Assert.IsNaN(layer.AssessmentLayerThree); + Assert.IsNaN(sectionResult.AssessmentLayerThree); } } } \ No newline at end of file