Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj =================================================================== diff -u -raa49537188229065df91b1a931f088c32115702a -r6c55d7ddb950eb8e434b9564367bffd9788876f8 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision aa49537188229065df91b1a931f088c32115702a) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 6c55d7ddb950eb8e434b9564367bffd9788876f8) @@ -222,7 +222,6 @@ RingtoetsEntities.tt - RingtoetsEntities.tt @@ -244,8 +243,6 @@ - - RingtoetsEntities.tt Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/IllustrationPoints/IllustrationPointNodeCreateExtensions.cs =================================================================== diff -u -r79565e60750c8a6c33847cd94d5c5910b77542b1 -r6c55d7ddb950eb8e434b9564367bffd9788876f8 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/IllustrationPoints/IllustrationPointNodeCreateExtensions.cs (.../IllustrationPointNodeCreateExtensions.cs) (revision 79565e60750c8a6c33847cd94d5c5910b77542b1) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/IllustrationPoints/IllustrationPointNodeCreateExtensions.cs (.../IllustrationPointNodeCreateExtensions.cs) (revision 6c55d7ddb950eb8e434b9564367bffd9788876f8) @@ -21,7 +21,6 @@ using System; using System.Collections.Generic; -using System.Linq; using Application.Ringtoets.Storage.DbContext; using Core.Common.Utils.Extensions; using Ringtoets.Common.Data.IllustrationPoints; @@ -65,7 +64,7 @@ FaultTreeIllustrationPointEntity entity = CreateFaultTreeIllustrationPoint(faultTreeIllustrationPoint, order); - CreateChildElements(illustrationPointNode.Children.ToArray(), entity); + CreateChildElements(illustrationPointNode.Children, entity); return entity; } @@ -95,13 +94,12 @@ } } - private static void CreateChildElements(IllustrationPointNode[] illustrationPointNodes, + private static void CreateChildElements(IEnumerable illustrationPointNodes, FaultTreeIllustrationPointEntity entity) { - for (var i = 0; i < illustrationPointNodes.Length; i++) + var i = 0; + foreach (IllustrationPointNode node in illustrationPointNodes) { - IllustrationPointNode node = illustrationPointNodes[i]; - var faultTreeIllustrationPoint = node.Data as FaultTreeIllustrationPoint; if (faultTreeIllustrationPoint != null) { @@ -113,6 +111,8 @@ { entity.SubMechanismIllustrationPointEntities.Add(subMechanismIllustrationPoint.Create(i)); } + + i++; } } } Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/IllustrationPoints/TopLevelFaultTreeIllustrationPointCreateExtensions.cs =================================================================== diff -u -r20a1edec7117a9cfee64e29c5eb7f00f4375e9c5 -r6c55d7ddb950eb8e434b9564367bffd9788876f8 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/IllustrationPoints/TopLevelFaultTreeIllustrationPointCreateExtensions.cs (.../TopLevelFaultTreeIllustrationPointCreateExtensions.cs) (revision 20a1edec7117a9cfee64e29c5eb7f00f4375e9c5) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/IllustrationPoints/TopLevelFaultTreeIllustrationPointCreateExtensions.cs (.../TopLevelFaultTreeIllustrationPointCreateExtensions.cs) (revision 6c55d7ddb950eb8e434b9564367bffd9788876f8) @@ -36,8 +36,8 @@ /// Creates a /// based on the information of . /// - /// The illustration point to create - /// a database entity for. + /// The top level illustration point to + /// create a database entity for. /// The index at which /// resides within its parent. /// A . @@ -58,7 +58,7 @@ ClosingSituation = topLevelFaultTreeIllustrationPoint.ClosingSituation.DeepClone(), WindDirectionName = windDirection.Name.DeepClone(), WindDirectionAngle = windDirection.Angle, - FaultTreeIllustrationPointEntity = + FaultTreeIllustrationPointEntity = topLevelFaultTreeIllustrationPoint.FaultTreeNodeRoot.Create(0), Order = order }; Fisheye: Tag 6c55d7ddb950eb8e434b9564367bffd9788876f8 refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/ITopLevelIllustrationPointEntity.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6c55d7ddb950eb8e434b9564367bffd9788876f8 refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/PartialTopLevelFaultTreeIllustrationPointEntity.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6c55d7ddb950eb8e434b9564367bffd9788876f8 refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/PartialTopLevelSubMechanismIllustrationPointEntity.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/IllustrationPoints/TopLevelFaultTreeIllustrationPointEntityReadExtensions.cs =================================================================== diff -u -r283d7e09d084caafac590fdf96bfc6a264604016 -r6c55d7ddb950eb8e434b9564367bffd9788876f8 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/IllustrationPoints/TopLevelFaultTreeIllustrationPointEntityReadExtensions.cs (.../TopLevelFaultTreeIllustrationPointEntityReadExtensions.cs) (revision 283d7e09d084caafac590fdf96bfc6a264604016) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/IllustrationPoints/TopLevelFaultTreeIllustrationPointEntityReadExtensions.cs (.../TopLevelFaultTreeIllustrationPointEntityReadExtensions.cs) (revision 6c55d7ddb950eb8e434b9564367bffd9788876f8) @@ -54,7 +54,7 @@ return new TopLevelFaultTreeIllustrationPoint(windDirection, entity.ClosingSituation, node); } - private static WindDirection GetWindDirection(ITopLevelIllustrationPointEntity entity) + private static WindDirection GetWindDirection(TopLevelFaultTreeIllustrationPointEntity entity) { return new WindDirection(entity.WindDirectionName, entity.WindDirectionAngle); Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/IllustrationPoints/TopLevelSubMechanismIllustrationPointReadExtensions.cs =================================================================== diff -u -r691d05e8ca094b05af1ec8aed83b8376051f7052 -r6c55d7ddb950eb8e434b9564367bffd9788876f8 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/IllustrationPoints/TopLevelSubMechanismIllustrationPointReadExtensions.cs (.../TopLevelSubMechanismIllustrationPointReadExtensions.cs) (revision 691d05e8ca094b05af1ec8aed83b8376051f7052) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/IllustrationPoints/TopLevelSubMechanismIllustrationPointReadExtensions.cs (.../TopLevelSubMechanismIllustrationPointReadExtensions.cs) (revision 6c55d7ddb950eb8e434b9564367bffd9788876f8) @@ -57,7 +57,7 @@ subMechanismIllustrationPoint); } - private static WindDirection GetWindDirection(ITopLevelIllustrationPointEntity entity) + private static WindDirection GetWindDirection(TopLevelSubMechanismIllustrationPointEntity entity) { return new WindDirection(entity.WindDirectionName, entity.WindDirectionAngle); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/IllustrationPoints/GeneralResultCreateExtensionsTest.cs =================================================================== diff -u -rc4289bccc81c65f0b9972d1e2d073aae31820fbf -r6c55d7ddb950eb8e434b9564367bffd9788876f8 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/IllustrationPoints/GeneralResultCreateExtensionsTest.cs (.../GeneralResultCreateExtensionsTest.cs) (revision c4289bccc81c65f0b9972d1e2d073aae31820fbf) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/IllustrationPoints/GeneralResultCreateExtensionsTest.cs (.../GeneralResultCreateExtensionsTest.cs) (revision 6c55d7ddb950eb8e434b9564367bffd9788876f8) @@ -37,11 +37,9 @@ [Test] public void CreateGeneralResultSubMechanismIllustrationPointEntity_GeneralResultNull_ThrowsArgumentNullException() { - // Setup - GeneralResult generalResult = null; - // Call - TestDelegate call = () => generalResult.CreateGeneralResultSubMechanismIllustrationPointEntity(); + TestDelegate call = () => ((GeneralResult) null) + .CreateGeneralResultSubMechanismIllustrationPointEntity(); // Assert var exception = Assert.Throws(call); @@ -91,7 +89,7 @@ } [Test] - public void CreateGeneralResultSubMechanismIllustrationPointEntity_ValidGeneralWithIllustrationPoints_ReturnsEntityWithTopLevelSubMechanismIllustrationPointEntities() + public void CreateGeneralResultSubMechanismIllustrationPointEntity_ValidGeneralResultWithIllustrationPoints_ReturnsEntityWithTopLevelSubMechanismIllustrationPointEntities() { // Setup var random = new Random(21); @@ -120,11 +118,9 @@ [Test] public void CreateGeneralResultFaultTreeIllustrationPointEntity_GeneralResultNull_ThrowsArgumentNullException() { - // Setup - GeneralResult generalResult = null; - // Call - TestDelegate call = () => generalResult.CreateGeneralResultFaultTreeIllustrationPointEntity(); + TestDelegate call = () => ((GeneralResult) null) + .CreateGeneralResultFaultTreeIllustrationPointEntity(); // Assert var exception = Assert.Throws(call); @@ -174,7 +170,7 @@ } [Test] - public void CreateGeneralResultFaultTreeIllustrationPointEntity_ValidGeneralWithIllustrationPoints_ReturnsEntityWithTopLevelFaultTreeIllustrationPointEntities() + public void CreateGeneralResultFaultTreeIllustrationPointEntity_ValidGeneralResultsWithIllustrationPoints_ReturnsEntityWithTopLevelFaultTreeIllustrationPointEntities() { // Setup var random = new Random(22); @@ -255,11 +251,10 @@ Assert.AreEqual(expectedOrder, stochastEntity.Order); } - private static void AssertITopLevelIllustrationPointEntities( + private static void AssertITopLevelIllustrationPointEntities( TTopLevelIllustrationPoint[] illustrationPoints, - TTopLevelIllustrationPointEntity[] illustrationPointEntities) + TopLevelSubMechanismIllustrationPointEntity[] illustrationPointEntities) where TTopLevelIllustrationPoint : TopLevelIllustrationPointBase - where TTopLevelIllustrationPointEntity : ITopLevelIllustrationPointEntity { Assert.AreEqual(illustrationPoints.Length, illustrationPointEntities.Length); @@ -271,12 +266,11 @@ } } - private static void AssertITopLevelIllustrationPointEntity( + private static void AssertITopLevelIllustrationPointEntity( TTopLevelIllustrationPoint illustrationPoint, - TTopLevelIllustrationPointEntity illustrationPointEntity, + TopLevelSubMechanismIllustrationPointEntity illustrationPointEntity, int expectedOrder) where TTopLevelIllustrationPoint : TopLevelIllustrationPointBase - where TTopLevelIllustrationPointEntity : ITopLevelIllustrationPointEntity { TestHelper.AssertAreEqualButNotSame(illustrationPoint.ClosingSituation, illustrationPointEntity.ClosingSituation); @@ -288,5 +282,37 @@ Assert.AreEqual(expectedOrder, illustrationPointEntity.Order); } + + private static void AssertITopLevelIllustrationPointEntities( + TTopLevelIllustrationPoint[] illustrationPoints, + TopLevelFaultTreeIllustrationPointEntity[] illustrationPointEntities) + where TTopLevelIllustrationPoint : TopLevelIllustrationPointBase + { + Assert.AreEqual(illustrationPoints.Length, illustrationPointEntities.Length); + + for (var i = 0; i < illustrationPoints.Length; i++) + { + AssertITopLevelIllustrationPointEntity(illustrationPoints[i], + illustrationPointEntities[i], + i); + } + } + + private static void AssertITopLevelIllustrationPointEntity( + TTopLevelIllustrationPoint illustrationPoint, + TopLevelFaultTreeIllustrationPointEntity illustrationPointEntity, + int expectedOrder) + where TTopLevelIllustrationPoint : TopLevelIllustrationPointBase + { + TestHelper.AssertAreEqualButNotSame(illustrationPoint.ClosingSituation, + illustrationPointEntity.ClosingSituation); + + WindDirection expectedWindDirection = illustrationPoint.WindDirection; + TestHelper.AssertAreEqualButNotSame(expectedWindDirection.Name, illustrationPointEntity.WindDirectionName); + Assert.AreEqual(expectedWindDirection.Angle, illustrationPointEntity.WindDirectionAngle, + expectedWindDirection.Angle.GetAccuracy()); + + Assert.AreEqual(expectedOrder, illustrationPointEntity.Order); + } } } \ No newline at end of file