Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsDikeHeightOutputEntityReadExtensions.cs =================================================================== diff -u -r5856d41b9f384ea1c20a51d637e9d45413df0a4d -r69742e05f20b6805772530c0cee69f7bf9fd813d --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsDikeHeightOutputEntityReadExtensions.cs (.../GrassCoverErosionInwardsDikeHeightOutputEntityReadExtensions.cs) (revision 5856d41b9f384ea1c20a51d637e9d45413df0a4d) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsDikeHeightOutputEntityReadExtensions.cs (.../GrassCoverErosionInwardsDikeHeightOutputEntityReadExtensions.cs) (revision 69742e05f20b6805772530c0cee69f7bf9fd813d) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.Read.IllustrationPoints; using Ringtoets.Common.Data.Hydraulics; using Ringtoets.GrassCoverErosionInwards.Data; @@ -54,7 +55,7 @@ entity.CalculatedProbability.ToNullAsNaN(), entity.CalculatedReliability.ToNullAsNaN(), (CalculationConvergence) entity.CalculationConvergence, - null); + entity.GeneralResultFaultTreeIllustrationPointEntity?.Read()); } } } \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsOutputEntityReadExtensions.cs =================================================================== diff -u -rce064290e953de172eb5823ad4caceb0342a0796 -r69742e05f20b6805772530c0cee69f7bf9fd813d --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsOutputEntityReadExtensions.cs (.../GrassCoverErosionInwardsOutputEntityReadExtensions.cs) (revision ce064290e953de172eb5823ad4caceb0342a0796) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsOutputEntityReadExtensions.cs (.../GrassCoverErosionInwardsOutputEntityReadExtensions.cs) (revision 69742e05f20b6805772530c0cee69f7bf9fd813d) @@ -22,6 +22,7 @@ using System; using System.Linq; using Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.Read.IllustrationPoints; using Ringtoets.Common.Data.Probability; using Ringtoets.GrassCoverErosionInwards.Data; @@ -40,8 +41,14 @@ /// The /// to create for. /// A new . + /// Thrown when + /// is null. internal static GrassCoverErosionInwardsOutput Read(this GrassCoverErosionInwardsOutputEntity entity) { + if (entity == null) + { + throw new ArgumentNullException(nameof(entity)); + } return new GrassCoverErosionInwardsOutput(GetOvertoppingOutput(entity), GetDikeHeightOutput(entity), GetOvertoppingRateOutput(entity)); @@ -52,7 +59,7 @@ return new OvertoppingOutput(entity.WaveHeight.ToNullAsNaN(), Convert.ToBoolean(entity.IsOvertoppingDominant), ReadProbabilityAssessmentOutput(entity), - null); + entity.GeneralResultFaultTreeIllustrationPointEntity?.Read()); } private static ProbabilityAssessmentOutput ReadProbabilityAssessmentOutput(GrassCoverErosionInwardsOutputEntity entity) Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsOvertoppingRateOutputEntityReadExtensions.cs =================================================================== diff -u -r5856d41b9f384ea1c20a51d637e9d45413df0a4d -r69742e05f20b6805772530c0cee69f7bf9fd813d --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsOvertoppingRateOutputEntityReadExtensions.cs (.../GrassCoverErosionInwardsOvertoppingRateOutputEntityReadExtensions.cs) (revision 5856d41b9f384ea1c20a51d637e9d45413df0a4d) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsOvertoppingRateOutputEntityReadExtensions.cs (.../GrassCoverErosionInwardsOvertoppingRateOutputEntityReadExtensions.cs) (revision 69742e05f20b6805772530c0cee69f7bf9fd813d) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.Read.IllustrationPoints; using Ringtoets.Common.Data.Hydraulics; using Ringtoets.GrassCoverErosionInwards.Data; @@ -54,7 +55,7 @@ entity.CalculatedProbability.ToNullAsNaN(), entity.CalculatedReliability.ToNullAsNaN(), (CalculationConvergence) entity.CalculationConvergence, - null); + entity.GeneralResultFaultTreeIllustrationPointEntity?.Read()); } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsDikeHeightOutputEntityReadExtensionsTest.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -r69742e05f20b6805772530c0cee69f7bf9fd813d --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsDikeHeightOutputEntityReadExtensionsTest.cs (.../GrassCoverErosionInwardsDikeHeightOutputEntityReadExtensionsTest.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsDikeHeightOutputEntityReadExtensionsTest.cs (.../GrassCoverErosionInwardsDikeHeightOutputEntityReadExtensionsTest.cs) (revision 69742e05f20b6805772530c0cee69f7bf9fd813d) @@ -22,6 +22,7 @@ using System; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Read.GrassCoverErosionInwards; +using Application.Ringtoets.Storage.TestUtil.IllustrationPoints; using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.Hydraulics; @@ -36,11 +37,8 @@ [Test] public void Read_EntityNull_ThrowArgumentNullException() { - // Setup - GrassCoverErosionInwardsDikeHeightOutputEntity entity = null; - // Call - TestDelegate test = () => entity.Read(); + TestDelegate test = () => ((GrassCoverErosionInwardsDikeHeightOutputEntity) null).Read(); // Assert var exception = Assert.Throws(test); @@ -78,6 +76,8 @@ Assert.AreEqual(calculatedProbability, output.CalculatedProbability); Assert.AreEqual(calculatedReliability, output.CalculatedReliability, output.CalculatedReliability.GetAccuracy()); Assert.AreEqual(convergence, output.CalculationConvergence); + GeneralResultEntityTestHelper.AssertGeneralResult(entity.GeneralResultFaultTreeIllustrationPointEntity, + output.GeneralResult); } [Test] @@ -101,6 +101,41 @@ Assert.IsNaN(output.CalculatedProbability); Assert.IsNaN(output.CalculatedReliability); Assert.AreEqual(convergence, output.CalculationConvergence); + GeneralResultEntityTestHelper.AssertGeneralResult(entity.GeneralResultFaultTreeIllustrationPointEntity, + output.GeneralResult); } + + [Test] + public void Read_WithGeneralResultEntity_ReturnsDikeHeightOutputWithGeneralResult() + { + // Setup + var random = new Random(22); + + var generalResultEntity = new GeneralResultFaultTreeIllustrationPointEntity + { + GoverningWindDirectionName = "SSE", + GoverningWindDirectionAngle = random.NextDouble() + }; + + var convergence = random.NextEnumValue(); + var entity = new GrassCoverErosionInwardsDikeHeightOutputEntity + { + CalculationConvergence = (byte) convergence, + GeneralResultFaultTreeIllustrationPointEntity = generalResultEntity + }; + + // Call + DikeHeightOutput output = entity.Read(); + + // Assert + Assert.IsNaN(output.DikeHeight); + Assert.IsNaN(output.TargetProbability); + Assert.IsNaN(output.TargetReliability); + Assert.IsNaN(output.CalculatedProbability); + Assert.IsNaN(output.CalculatedReliability); + Assert.AreEqual(convergence, output.CalculationConvergence); + GeneralResultEntityTestHelper.AssertGeneralResult(generalResultEntity, + output.GeneralResult); + } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsOutputEntityReadExtensionsTest.cs =================================================================== diff -u -ra64e778ac45d89e0bc35900b5c5b4a85e1f24089 -r69742e05f20b6805772530c0cee69f7bf9fd813d --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsOutputEntityReadExtensionsTest.cs (.../GrassCoverErosionInwardsOutputEntityReadExtensionsTest.cs) (revision a64e778ac45d89e0bc35900b5c5b4a85e1f24089) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsOutputEntityReadExtensionsTest.cs (.../GrassCoverErosionInwardsOutputEntityReadExtensionsTest.cs) (revision 69742e05f20b6805772530c0cee69f7bf9fd813d) @@ -22,6 +22,7 @@ using System; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Read.GrassCoverErosionInwards; +using Application.Ringtoets.Storage.TestUtil.IllustrationPoints; using NUnit.Framework; using Ringtoets.Common.Data.Probability; using Ringtoets.GrassCoverErosionInwards.Data; @@ -32,6 +33,17 @@ public class GrassCoverErosionInwardsOutputEntityReadExtensionsTest { [Test] + public void Read_EntityNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => ((GrassCoverErosionInwardsOutputEntity) null).Read(); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("entity", exception.ParamName); + } + + [Test] public void Read_ValidEntity_ReturnGrassCoverErosionInwardsOutput() { // Setup @@ -76,7 +88,8 @@ RequiredProbability = null, RequiredReliability = null, Reliability = null, - FactorOfSafety = null + FactorOfSafety = null, + GeneralResultFaultTreeIllustrationPointEntity = null }; // Call @@ -95,9 +108,51 @@ Assert.IsNaN(probabilityAssessmentOutput.RequiredProbability); Assert.IsNaN(probabilityAssessmentOutput.Reliability); Assert.IsNaN(probabilityAssessmentOutput.RequiredReliability); + GeneralResultEntityTestHelper.AssertGeneralResult(entity.GeneralResultFaultTreeIllustrationPointEntity, overtoppingOutput.GeneralResult); } [Test] + public void Read_ValidEntityWithGeneralResultEntity_ReturnsGrassCoverErosionInwardsOutputWithGeneralResult() + { + // Setup + var generalResultEntity = new GeneralResultFaultTreeIllustrationPointEntity + { + GoverningWindDirectionAngle = 10, + GoverningWindDirectionName = "SSE" + }; + var entity = new GrassCoverErosionInwardsOutputEntity + { + WaveHeight = null, + IsOvertoppingDominant = Convert.ToByte(true), + Probability = null, + RequiredProbability = null, + RequiredReliability = null, + Reliability = null, + FactorOfSafety = null, + GeneralResultFaultTreeIllustrationPointEntity = generalResultEntity + }; + + // Call + GrassCoverErosionInwardsOutput output = entity.Read(); + + // Assert + OvertoppingOutput overtoppingOutput = output.OvertoppingOutput; + ProbabilityAssessmentOutput probabilityAssessmentOutput = overtoppingOutput.ProbabilityAssessmentOutput; + + Assert.IsNaN(overtoppingOutput.WaveHeight); + Assert.IsTrue(overtoppingOutput.IsOvertoppingDominant); + Assert.IsNull(output.DikeHeightOutput); + Assert.IsNull(output.OvertoppingRateOutput); + Assert.IsNaN(probabilityAssessmentOutput.FactorOfSafety); + Assert.IsNaN(probabilityAssessmentOutput.Probability); + Assert.IsNaN(probabilityAssessmentOutput.RequiredProbability); + Assert.IsNaN(probabilityAssessmentOutput.Reliability); + Assert.IsNaN(probabilityAssessmentOutput.RequiredReliability); + + GeneralResultEntityTestHelper.AssertGeneralResult(generalResultEntity, overtoppingOutput.GeneralResult); + } + + [Test] public void Read_ValidEntityWithDikeHeightOutputEntity_ReturnGrassCoverErosionInwardsOutputWithDikeHeightOutput() { // Setup Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsOvertoppingRateOutputEntityReadExtensionsTest.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -r69742e05f20b6805772530c0cee69f7bf9fd813d --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsOvertoppingRateOutputEntityReadExtensionsTest.cs (.../GrassCoverErosionInwardsOvertoppingRateOutputEntityReadExtensionsTest.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsOvertoppingRateOutputEntityReadExtensionsTest.cs (.../GrassCoverErosionInwardsOvertoppingRateOutputEntityReadExtensionsTest.cs) (revision 69742e05f20b6805772530c0cee69f7bf9fd813d) @@ -22,6 +22,7 @@ using System; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Read.GrassCoverErosionInwards; +using Application.Ringtoets.Storage.TestUtil.IllustrationPoints; using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.Hydraulics; @@ -36,11 +37,8 @@ [Test] public void Read_EntityNull_ThrowArgumentNullException() { - // Setup - GrassCoverErosionInwardsOvertoppingRateOutputEntity entity = null; - // Call - TestDelegate test = () => entity.Read(); + TestDelegate test = () => ((GrassCoverErosionInwardsOvertoppingRateOutputEntity) null).Read(); // Assert var exception = Assert.Throws(test); @@ -78,6 +76,9 @@ Assert.AreEqual(calculatedProbability, output.CalculatedProbability); Assert.AreEqual(calculatedReliability, output.CalculatedReliability, output.CalculatedReliability.GetAccuracy()); Assert.AreEqual(convergence, output.CalculationConvergence); + + GeneralResultEntityTestHelper.AssertGeneralResult(entity.GeneralResultFaultTreeIllustrationPointEntity, + output.GeneralResult); } [Test] @@ -101,6 +102,42 @@ Assert.IsNaN(output.CalculatedProbability); Assert.IsNaN(output.CalculatedReliability); Assert.AreEqual(convergence, output.CalculationConvergence); + + GeneralResultEntityTestHelper.AssertGeneralResult(entity.GeneralResultFaultTreeIllustrationPointEntity, + output.GeneralResult); } + + [Test] + public void Read_ValidEntityWithGeneralResultEntity_ReturnsOvertoppingRateOutputWithGeneralResult() + { + // Setup + var random = new Random(22); + var generalResultEntity = new GeneralResultFaultTreeIllustrationPointEntity + { + GoverningWindDirectionName = "SSE", + GoverningWindDirectionAngle = random.NextDouble() + }; + + var convergence = random.NextEnumValue(); + var entity = new GrassCoverErosionInwardsOvertoppingRateOutputEntity + { + CalculationConvergence = (byte) convergence, + GeneralResultFaultTreeIllustrationPointEntity = generalResultEntity + }; + + // Call + OvertoppingRateOutput output = entity.Read(); + + // Assert + Assert.IsNaN(output.OvertoppingRate); + Assert.IsNaN(output.TargetProbability); + Assert.IsNaN(output.TargetReliability); + Assert.IsNaN(output.CalculatedProbability); + Assert.IsNaN(output.CalculatedReliability); + Assert.AreEqual(convergence, output.CalculationConvergence); + + GeneralResultEntityTestHelper.AssertGeneralResult(generalResultEntity, + output.GeneralResult); + } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/IllustrationPoints/GeneralResultEntityTestHelperTest.cs =================================================================== diff -u -r12d68f588f3d39996a3a34577f9ec94a87bec865 -r69742e05f20b6805772530c0cee69f7bf9fd813d --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/IllustrationPoints/GeneralResultEntityTestHelperTest.cs (.../GeneralResultEntityTestHelperTest.cs) (revision 12d68f588f3d39996a3a34577f9ec94a87bec865) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/IllustrationPoints/GeneralResultEntityTestHelperTest.cs (.../GeneralResultEntityTestHelperTest.cs) (revision 69742e05f20b6805772530c0cee69f7bf9fd813d) @@ -91,15 +91,131 @@ Assert.Throws(call); } + [Test] + public void AssertGeneralResult_WithNullArguments_DoesNotThrowException() + { + // Call + TestDelegate call = () => GeneralResultEntityTestHelper.AssertGeneralResult(null, null); + + // Assert + Assert.DoesNotThrow(call); + } + + [Test] + public void AssertGeneralResult_WithExpectedProperties_DoesNotThrowException() + { + // Setup + var random = new Random(21); + + var generalResultEntity = new GeneralResultFaultTreeIllustrationPointEntity + { + GoverningWindDirectionName = "SSE", + GoverningWindDirectionAngle = 30 + }; + generalResultEntity.StochastEntities.Add(new StochastEntity()); + generalResultEntity.TopLevelFaultTreeIllustrationPointEntities.Add(new TopLevelFaultTreeIllustrationPointEntity()); + + var governingWindDirection = new WindDirection(generalResultEntity.GoverningWindDirectionName, + generalResultEntity.GoverningWindDirectionAngle); + var stochast = new Stochast("Stochast", random.NextDouble(), random.NextDouble()); + var topLevelFaultTreeIllustrationPoint = new TopLevelFaultTreeIllustrationPoint(WindDirectionTestFactory.CreateTestWindDirection(), + string.Empty, + new IllustrationPointNode(new TestFaultTreeIllustrationPoint())); + + var generalResult = new GeneralResult( + governingWindDirection, new[] + { + stochast + }, new[] + { + topLevelFaultTreeIllustrationPoint + }); + + // Call + TestDelegate call = () => GeneralResultEntityTestHelper.AssertGeneralResult(generalResultEntity, generalResult); + + // Assert + Assert.DoesNotThrow(call); + } + + [Test] + [TestCaseSource(nameof(GetDifferentGeneralResultProperties))] + public void AssertGeneralResult_DifferentPropertyValues_ThrowsAssertionException(GeneralResultFaultTreeIllustrationPointEntity generalResultEntity, + GeneralResult generalResult) + { + // Call + TestDelegate call = () => GeneralResultEntityTestHelper.AssertGeneralResult(generalResultEntity, generalResult); + + // Assert + Assert.Throws(call); + } + + #region TestData GeneralResult + + private static IEnumerable GetDifferentGeneralResultProperties() + { + var generalResultEntity = new GeneralResultFaultTreeIllustrationPointEntity + { + GoverningWindDirectionName = "SSE", + GoverningWindDirectionAngle = 30 + }; + var baseLineGoverningWindDirection = new WindDirection(generalResultEntity.GoverningWindDirectionName, + generalResultEntity.GoverningWindDirectionAngle); + + yield return new TestCaseData(null, new GeneralResult( + baseLineGoverningWindDirection, + Enumerable.Empty(), + Enumerable.Empty())) + .SetName("GeneralResultNotNullWhenExpectedNull"); + yield return new TestCaseData(generalResultEntity, null).SetName("GeneralResultNullWhenExpectedNotNull"); + + yield return new TestCaseData(generalResultEntity, + new GeneralResult(new WindDirection("DifferentName", + baseLineGoverningWindDirection.Angle), + Enumerable.Empty(), + Enumerable.Empty())) + .SetName("GeneralResultDoesNotMatchWindDirectionName"); + + yield return new TestCaseData(generalResultEntity, + new GeneralResult(new WindDirection(baseLineGoverningWindDirection.Name, + 10), + Enumerable.Empty(), + Enumerable.Empty())) + .SetName("GeneralResultDoesNotMatchWindDirectionAngle"); + + yield return new TestCaseData(generalResultEntity, + new GeneralResult(baseLineGoverningWindDirection, + new[] + { + new Stochast("Wrong item", double.NaN, double.NaN) + }, Enumerable.Empty())) + .SetName("GeneralResultDoesNotMatchStochastCount"); + yield return new TestCaseData(generalResultEntity, + new GeneralResult( + baseLineGoverningWindDirection, + Enumerable.Empty(), + new[] + { + new TopLevelFaultTreeIllustrationPoint(WindDirectionTestFactory.CreateTestWindDirection(), + string.Empty, + new IllustrationPointNode(new TestFaultTreeIllustrationPoint())) + })) + .SetName("GeneralResultDoesNotMatchTopLevelIllustrationPointCount"); + } + + #endregion + + #region TestData GeneralResultEntity + private static IEnumerable GetDifferentGeneralResultEntityProperties() { var governingWindDirection = new WindDirection("SSE", 50); var generalResult = new GeneralResult(governingWindDirection, Enumerable.Empty(), Enumerable.Empty()); - yield return new TestCaseData(null, new GeneralResultFaultTreeIllustrationPointEntity()).SetName("EntityNotNull"); - yield return new TestCaseData(new TestGeneralResultFaultTreeIllustrationPoint(), null).SetName("EntityNull"); + yield return new TestCaseData(null, new GeneralResultFaultTreeIllustrationPointEntity()).SetName("EntityNotNullWhenExpectedNull"); + yield return new TestCaseData(new TestGeneralResultFaultTreeIllustrationPoint(), null).SetName("EntityNullWhenExpectedNotNull"); GeneralResultFaultTreeIllustrationPointEntity generalResultEntityWrongStochastCount = GetBaseLineGeneralResultEntity(governingWindDirection); @@ -135,5 +251,7 @@ GoverningWindDirectionAngle = windDirection.Angle }; } + + #endregion } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/IllustrationPoints/GeneralResultEntityTestHelper.cs =================================================================== diff -u -r12d68f588f3d39996a3a34577f9ec94a87bec865 -r69742e05f20b6805772530c0cee69f7bf9fd813d --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/IllustrationPoints/GeneralResultEntityTestHelper.cs (.../GeneralResultEntityTestHelper.cs) (revision 12d68f588f3d39996a3a34577f9ec94a87bec865) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/IllustrationPoints/GeneralResultEntityTestHelper.cs (.../GeneralResultEntityTestHelper.cs) (revision 69742e05f20b6805772530c0cee69f7bf9fd813d) @@ -36,9 +36,19 @@ /// Determines if the properties of the match /// with the . /// - /// The to assert against. + /// The to assert against to. /// The - /// to assert against to. + /// to assert. + /// Thrown when: + /// + /// is null and + /// is not null. + /// is not null and + /// is null. + /// The values of the governing wind direction name and angles do not match. + /// The count of the stochasts do not match. + /// The count of the top level illustration points do not match. + /// /// This only asserts the properties of the /// that are directly associated with it, but not the values of the items it is composed of. public static void AssertGeneralResultEntity(GeneralResult generalResult, @@ -60,5 +70,43 @@ Assert.AreEqual(generalResult.Stochasts.Count(), generalResultEntity.StochastEntities.Count); Assert.AreEqual(generalResult.TopLevelIllustrationPoints.Count(), generalResultEntity.TopLevelFaultTreeIllustrationPointEntities.Count); } + + /// + /// Determines if the properties of the match + /// with the . + /// + /// The + /// to assert against to. + /// The to assert. + /// Thrown when: + /// + /// is null and + /// is not null. + /// is not null and + /// is null. + /// The values of the governing wind direction name and angles do not match. + /// The count of the stochasts do not match. + /// The count of the top level illustration points do not match. + /// + /// This only asserts the properties of that are directly + /// associated with it, but not the value of the items it is composed of. + public static void AssertGeneralResult(GeneralResultFaultTreeIllustrationPointEntity generalResultEntity, + GeneralResult generalResult) + { + if (generalResultEntity == null) + { + Assert.IsNull(generalResult); + return; + } + + Assert.IsNotNull(generalResult); + + WindDirection governingWindDirection = generalResult.GoverningWindDirection; + Assert.AreEqual(generalResultEntity.GoverningWindDirectionName, governingWindDirection.Name); + Assert.AreEqual(generalResultEntity.GoverningWindDirectionAngle, governingWindDirection.Angle, governingWindDirection.Angle.GetAccuracy()); + + Assert.AreEqual(generalResultEntity.TopLevelFaultTreeIllustrationPointEntities.Count, generalResult.TopLevelIllustrationPoints.Count()); + Assert.AreEqual(generalResultEntity.StochastEntities.Count, generalResult.Stochasts.Count()); + } } } \ No newline at end of file