Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ClosingStructures/ClosingStructuresSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u -r3a7eb07c13a15f90342ac16fb4dc9f0df32a9c5a -ree999e492a57d9bbb3777754651e9f4722611075 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ClosingStructures/ClosingStructuresSectionResultEntityReadExtensionsTest.cs (.../ClosingStructuresSectionResultEntityReadExtensionsTest.cs) (revision 3a7eb07c13a15f90342ac16fb4dc9f0df32a9c5a) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ClosingStructures/ClosingStructuresSectionResultEntityReadExtensionsTest.cs (.../ClosingStructuresSectionResultEntityReadExtensionsTest.cs) (revision ee999e492a57d9bbb3777754651e9f4722611075) @@ -26,6 +26,7 @@ using Application.Ringtoets.Storage.TestUtil; using NUnit.Framework; using Ringtoets.ClosingStructures.Data; +using Ringtoets.Common.Data.Structures; using Ringtoets.Integration.Data.StandAlone.SectionResults; namespace Application.Ringtoets.Storage.Test.Read.ClosingStructures @@ -40,14 +41,29 @@ var entity = new ClosingStructuresSectionResultEntity(); // Call - TestDelegate call = () => entity.Read(null); + TestDelegate call = () => entity.Read(null, new ReadConversionCollector()); // Assert string paramName = Assert.Throws(call).ParamName; Assert.AreEqual("sectionResult", paramName); } [Test] + public void Read_CollectorIsNull_ThrowArgumentNullException() + { + // Setup + var entity = new ClosingStructuresSectionResultEntity(); + + // Call + TestDelegate call = () => entity.Read(new ClosingStructuresFailureMechanismSectionResult( + new TestFailureMechanismSection()), null); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("collector", paramName); + } + + [Test] [TestCase(true)] [TestCase(false)] public void Read_WithDecimalParameterValues_ReturnClosingStructuresSectionResultWithDoubleParameterValues(bool layerOne) @@ -68,7 +84,7 @@ var sectionResult = new ClosingStructuresFailureMechanismSectionResult(new TestFailureMechanismSection()); // Call - entity.Read(sectionResult); + entity.Read(sectionResult, collector); // Assert Assert.IsNotNull(sectionResult); @@ -94,10 +110,34 @@ var sectionResult = new ClosingStructuresFailureMechanismSectionResult(new TestFailureMechanismSection()); // Call - entity.Read(sectionResult); + entity.Read(sectionResult, collector); // Assert Assert.IsNaN(sectionResult.AssessmentLayerThree); } + + [Test] + public void Read_CalculationEntitySet_ReturnClosingStructuresSectionResultWithCalculation() + { + // Setup + var calculation = new StructuresCalculation(); + + var calculationEntity = new ClosingStructuresCalculationEntity(); + + var collector = new ReadConversionCollector(); + collector.Read(calculationEntity, calculation); + + var entity = new ClosingStructuresSectionResultEntity + { + ClosingStructuresCalculationEntity = calculationEntity + }; + var sectionResult = new ClosingStructuresFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult, collector); + + // Assert + Assert.AreSame(calculation, sectionResult.Calculation); + } } } \ No newline at end of file