Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/IllustrationPoints/GeneralResultCreateExtensionsTest.cs =================================================================== diff -u -r20a1edec7117a9cfee64e29c5eb7f00f4375e9c5 -rc4289bccc81c65f0b9972d1e2d073aae31820fbf --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/IllustrationPoints/GeneralResultCreateExtensionsTest.cs (.../GeneralResultCreateExtensionsTest.cs) (revision 20a1edec7117a9cfee64e29c5eb7f00f4375e9c5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/IllustrationPoints/GeneralResultCreateExtensionsTest.cs (.../GeneralResultCreateExtensionsTest.cs) (revision c4289bccc81c65f0b9972d1e2d073aae31820fbf) @@ -173,6 +173,35 @@ AssertGeneralResultFaultTreeIllustrationPointEntity(generalResult, entity); } + [Test] + public void CreateGeneralResultFaultTreeIllustrationPointEntity_ValidGeneralWithIllustrationPoints_ReturnsEntityWithTopLevelFaultTreeIllustrationPointEntities() + { + // Setup + var random = new Random(22); + + var generalResult = new GeneralResult( + new WindDirection("SSE", random.NextDouble()), + Enumerable.Empty(), + new[] + { + new TopLevelFaultTreeIllustrationPoint( + WindDirectionTestFactory.CreateTestWindDirection(), + "IllustrationPointOne", + new IllustrationPointNode(FaultTreeIllustrationPointTestFactory.CreateTestFaultTreeIllustrationPoint())), + new TopLevelFaultTreeIllustrationPoint( + WindDirectionTestFactory.CreateTestWindDirection(), + "IllustrationPointTwo", + new IllustrationPointNode(FaultTreeIllustrationPointTestFactory.CreateTestFaultTreeIllustrationPoint())) + }); + + // Call + GeneralResultFaultTreeIllustrationPointEntity entity = + generalResult.CreateGeneralResultFaultTreeIllustrationPointEntity(); + + // Assert + AssertGeneralResultFaultTreeIllustrationPointEntity(generalResult, entity); + } + private static void AssertGeneralResultSubMechanismIllustrationPointEntity( GeneralResult generalResult, GeneralResultSubMechanismIllustrationPointEntity entity) Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/IllustrationPoints/TopLevelFaultTreeIllustrationPointCreateExtensionsTest.cs =================================================================== diff -u -r20a1edec7117a9cfee64e29c5eb7f00f4375e9c5 -rc4289bccc81c65f0b9972d1e2d073aae31820fbf --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/IllustrationPoints/TopLevelFaultTreeIllustrationPointCreateExtensionsTest.cs (.../TopLevelFaultTreeIllustrationPointCreateExtensionsTest.cs) (revision 20a1edec7117a9cfee64e29c5eb7f00f4375e9c5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/IllustrationPoints/TopLevelFaultTreeIllustrationPointCreateExtensionsTest.cs (.../TopLevelFaultTreeIllustrationPointCreateExtensionsTest.cs) (revision c4289bccc81c65f0b9972d1e2d073aae31820fbf) @@ -21,8 +21,12 @@ using System; using Application.Ringtoets.Storage.Create.IllustrationPoints; +using Application.Ringtoets.Storage.DbContext; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.IllustrationPoints; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Data.TestUtil.IllustrationPoints; namespace Application.Ringtoets.Storage.Test.Create.IllustrationPoints { @@ -39,5 +43,28 @@ var exception = Assert.Throws(call); Assert.AreEqual("topLevelFaultTreeIllustrationPoint", exception.ParamName); } + + [Test] + public void Create_ValidTopLevelFaultTreeIllustrationPoint_ReturnsTopLevelFaultTreeIllustrationPointEntity() + { + // Setup + var random = new Random(21); + + var windDirection = new WindDirection("WindDirection Name", random.NextDouble()); + var illustrationPoint = new TopLevelFaultTreeIllustrationPoint( + windDirection, + "Just a situation", + new IllustrationPointNode(FaultTreeIllustrationPointTestFactory.CreateTestFaultTreeIllustrationPoint())); + int order = random.Next(); + + // Call + TopLevelFaultTreeIllustrationPointEntity entity = illustrationPoint.Create(order); + + // Assert + TestHelper.AssertAreEqualButNotSame(illustrationPoint.ClosingSituation, entity.ClosingSituation); + TestHelper.AssertAreEqualButNotSame(windDirection.Name, entity.WindDirectionName); + Assert.AreEqual(windDirection.Angle, entity.WindDirectionAngle, windDirection.Angle.GetAccuracy()); + Assert.AreEqual(order, entity.Order); + } } } \ No newline at end of file