Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StabilityPointStructures/StabilityPointStructureCalculationEntityReadExtensions.cs =================================================================== diff -u -r43f72f0cd1f19b6bef02964ac191973d6077c74c -rc3378ccfc96767cbac99fa57ae60d08667555f01 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StabilityPointStructures/StabilityPointStructureCalculationEntityReadExtensions.cs (.../StabilityPointStructureCalculationEntityReadExtensions.cs) (revision 43f72f0cd1f19b6bef02964ac191973d6077c74c) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StabilityPointStructures/StabilityPointStructureCalculationEntityReadExtensions.cs (.../StabilityPointStructureCalculationEntityReadExtensions.cs) (revision c3378ccfc96767cbac99fa57ae60d08667555f01) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using System.Linq; using Application.Ringtoets.Storage.DbContext; using Core.Common.Base.Data; using Ringtoets.Common.Data.Structures; @@ -55,6 +56,7 @@ Comments = entity.Comments }; ReadInputParameters(calculation.InputParameters, entity, collector); + ReadOutput(calculation, entity); return calculation; } @@ -101,11 +103,20 @@ inputParameters.StabilityQuadraticLoadModel.CoefficientOfVariation = (RoundedDouble) entity.StabilityQuadraticLoadModelCoefficientOfVariation.ToNullAsNaN(); inputParameters.AreaFlowApertures.Mean = (RoundedDouble) entity.AreaFlowAperturesMean.ToNullAsNaN(); inputParameters.AreaFlowApertures.StandardDeviation = (RoundedDouble) entity.AreaFlowAperturesStandardDeviation.ToNullAsNaN(); - inputParameters.InflowModelType = (StabilityPointStructureInflowModelType)entity.InflowModelType; - inputParameters.LoadSchematizationType = (LoadSchematizationType)entity.LoadSchematizationType; + inputParameters.InflowModelType = (StabilityPointStructureInflowModelType) entity.InflowModelType; + inputParameters.LoadSchematizationType = (LoadSchematizationType) entity.LoadSchematizationType; inputParameters.VolumicWeightWater = (RoundedDouble) entity.VolumicWeightWater.ToNullAsNaN(); inputParameters.FactorStormDurationOpenStructure = (RoundedDouble) entity.FactorStormDurationOpenStructure.ToNullAsNaN(); inputParameters.DrainCoefficient.Mean = (RoundedDouble) entity.DrainCoefficientMean.ToNullAsNaN(); } + + private static void ReadOutput(StructuresCalculation calculation, StabilityPointStructuresCalculationEntity entity) + { + StabilityPointStructuresOutputEntity output = entity.StabilityPointStructuresOutputEntities.FirstOrDefault(); + if (output != null) + { + calculation.Output = output.Read(); + } + } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ClosingStructures/ClosingStructuresCalculationEntityReadExtensionsTest.cs =================================================================== diff -u -re440a0fe415d87b898ae1b6ad2e4ba98d0f104cf -rc3378ccfc96767cbac99fa57ae60d08667555f01 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ClosingStructures/ClosingStructuresCalculationEntityReadExtensionsTest.cs (.../ClosingStructuresCalculationEntityReadExtensionsTest.cs) (revision e440a0fe415d87b898ae1b6ad2e4ba98d0f104cf) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ClosingStructures/ClosingStructuresCalculationEntityReadExtensionsTest.cs (.../ClosingStructuresCalculationEntityReadExtensionsTest.cs) (revision c3378ccfc96767cbac99fa57ae60d08667555f01) @@ -314,7 +314,6 @@ Assert.IsTrue(calculation.HasOutput); } - [Test] public void Read_CalculationEntityAlreadyRead_ReturnReadCalculation() { Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityPointStructures/StabilityPointStructureCalculationEntityReadExtensionsTest.cs =================================================================== diff -u -r43f72f0cd1f19b6bef02964ac191973d6077c74c -rc3378ccfc96767cbac99fa57ae60d08667555f01 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityPointStructures/StabilityPointStructureCalculationEntityReadExtensionsTest.cs (.../StabilityPointStructureCalculationEntityReadExtensionsTest.cs) (revision 43f72f0cd1f19b6bef02964ac191973d6077c74c) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityPointStructures/StabilityPointStructureCalculationEntityReadExtensionsTest.cs (.../StabilityPointStructureCalculationEntityReadExtensionsTest.cs) (revision c3378ccfc96767cbac99fa57ae60d08667555f01) @@ -180,11 +180,12 @@ Assert.AreEqual(entity.StabilityQuadraticLoadModelCoefficientOfVariation, inputParameters.StabilityQuadraticLoadModel.CoefficientOfVariation.Value); Assert.AreEqual(entity.AreaFlowAperturesMean, inputParameters.AreaFlowApertures.Mean.Value); Assert.AreEqual(entity.AreaFlowAperturesStandardDeviation, inputParameters.AreaFlowApertures.StandardDeviation.Value); - Assert.AreEqual((StabilityPointStructureInflowModelType)entity.InflowModelType, inputParameters.InflowModelType); - Assert.AreEqual((LoadSchematizationType)entity.LoadSchematizationType, inputParameters.LoadSchematizationType); + Assert.AreEqual((StabilityPointStructureInflowModelType) entity.InflowModelType, inputParameters.InflowModelType); + Assert.AreEqual((LoadSchematizationType) entity.LoadSchematizationType, inputParameters.LoadSchematizationType); Assert.AreEqual(entity.VolumicWeightWater, inputParameters.VolumicWeightWater.Value); Assert.AreEqual(entity.FactorStormDurationOpenStructure, inputParameters.FactorStormDurationOpenStructure.Value); Assert.AreEqual(entity.DrainCoefficientMean, inputParameters.DrainCoefficient.Mean.Value); + Assert.IsFalse(calculation.HasOutput); } [Test] @@ -360,5 +361,26 @@ // Assert Assert.AreSame(profile, calculation.InputParameters.ForeshoreProfile); } + + [Test] + public void Read_ValidEntityWithOutputEntity_ReturnCalculationWithOutput() + { + // Setup + var entity = new StabilityPointStructuresCalculationEntity + { + StabilityPointStructuresOutputEntities = + { + new StabilityPointStructuresOutputEntity() + } + }; + + var collector = new ReadConversionCollector(); + + // Call + StructuresCalculation calculation = entity.Read(collector); + + // Assert + Assert.IsTrue(calculation.HasOutput); + } } } \ No newline at end of file