Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/IllustrationPoints/GeneralResultCreateExtensions.cs =================================================================== diff -u -r72915c82fc1b1222de1b88548f9c80c8d01a12b6 -ra14245a5852a6fbbad03780a33599ff8e365f84b --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/IllustrationPoints/GeneralResultCreateExtensions.cs (.../GeneralResultCreateExtensions.cs) (revision 72915c82fc1b1222de1b88548f9c80c8d01a12b6) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/IllustrationPoints/GeneralResultCreateExtensions.cs (.../GeneralResultCreateExtensions.cs) (revision a14245a5852a6fbbad03780a33599ff8e365f84b) @@ -34,33 +34,30 @@ internal static class GeneralResultCreateExtensions { /// - /// Creates a based on the - /// information of . + /// Creates a based on + /// the information of . /// - /// The general result sub mechanism - /// to create a database entity for. + /// The general result sub mechanism to create a database + /// entity for. /// A new . - /// Thrown when + /// Thrown when /// is null. public static GeneralResultSubMechanismIllustrationPointEntity CreateGeneralResultSubMechanismIllustrationPointEntity( - this GeneralResult generalResultSubMechanismIllustrationPoint) + this GeneralResult generalResult) { - if (generalResultSubMechanismIllustrationPoint == null) + if (generalResult == null) { - throw new ArgumentNullException(nameof(generalResultSubMechanismIllustrationPoint)); + throw new ArgumentNullException(nameof(generalResult)); } - WindDirection governingWindDirection = generalResultSubMechanismIllustrationPoint.GoverningWindDirection; - var entity = new GeneralResultSubMechanismIllustrationPointEntity - { - GoverningWindDirectionName = governingWindDirection.Name.DeepClone(), - GoverningWindDirectionAngle = governingWindDirection.Angle - }; + var entity = new GeneralResultSubMechanismIllustrationPointEntity(); - AddEntitiesForStochasts(entity, generalResultSubMechanismIllustrationPoint.Stochasts); + SetGoverningWindDirection(entity, generalResult.GoverningWindDirection); + + AddEntitiesForStochasts(entity, generalResult.Stochasts); AddEntitiesForTopLevelSubMechanismIllustrationPoints( entity, - generalResultSubMechanismIllustrationPoint.TopLevelIllustrationPoints); + generalResult.TopLevelIllustrationPoints); return entity; } @@ -70,7 +67,7 @@ /// information of . /// /// The general result to create a database entity for. - /// A new . + /// A new . /// Thrown when /// is null. public static GeneralResultFaultTreeIllustrationPointEntity CreateGeneralResultFaultTreeIllustrationPointEntity( @@ -81,31 +78,25 @@ throw new ArgumentNullException(nameof(generalResult)); } - WindDirection governingWindDirection = generalResult.GoverningWindDirection; - var entity = new GeneralResultFaultTreeIllustrationPointEntity - { - GoverningWindDirectionAngle = governingWindDirection.Angle, - GoverningWindDirectionName = governingWindDirection.Name.DeepClone() - }; + var entity = new GeneralResultFaultTreeIllustrationPointEntity(); + SetGoverningWindDirection(entity, generalResult.GoverningWindDirection); + AddEntitiesForStochasts(entity, generalResult.Stochasts); AddEntitiesForTopLevelFaultTreeIllustrationPoints( entity, generalResult.TopLevelIllustrationPoints); return entity; } - private static void AddEntitiesForStochasts(GeneralResultSubMechanismIllustrationPointEntity entity, - IEnumerable stochasts) + private static void SetGoverningWindDirection(IGeneralResultEntity generalResultEntity, + WindDirection windDirection) { - var order = 0; - foreach (Stochast stochast in stochasts) - { - entity.StochastEntities.Add(stochast.Create(order++)); - } + generalResultEntity.GoverningWindDirectionAngle = windDirection.Angle; + generalResultEntity.GoverningWindDirectionName = windDirection.Name.DeepClone(); } - private static void AddEntitiesForStochasts(GeneralResultFaultTreeIllustrationPointEntity entity, + private static void AddEntitiesForStochasts(IGeneralResultEntity entity, IEnumerable stochasts) { var order = 0;