Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj =================================================================== diff -u -rfc8042d95d25d97f3e8a85fdd557771f718229f8 -rfaeb56f2d76b07f370127de2beb66edad2dea6af --- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision fc8042d95d25d97f3e8a85fdd557771f718229f8) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision faeb56f2d76b07f370127de2beb66edad2dea6af) @@ -70,7 +70,7 @@ Code - + @@ -163,6 +163,7 @@ RingtoetsEntities.tt + RingtoetsEntities.tt @@ -172,6 +173,7 @@ RingtoetsEntities.tt + RingtoetsEntities.tt Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructures/HeightStructuresCalculationCreateExtensions.cs =================================================================== diff -u -r9ecb8c95c16dd159ca49930ebd8e5d8e2af7c297 -rfaeb56f2d76b07f370127de2beb66edad2dea6af --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructures/HeightStructuresCalculationCreateExtensions.cs (.../HeightStructuresCalculationCreateExtensions.cs) (revision 9ecb8c95c16dd159ca49930ebd8e5d8e2af7c297) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructures/HeightStructuresCalculationCreateExtensions.cs (.../HeightStructuresCalculationCreateExtensions.cs) (revision faeb56f2d76b07f370127de2beb66edad2dea6af) @@ -60,7 +60,7 @@ if (calculation.HasOutput) { - entity.HeightStructuresOutputEntities.Add(calculation.Output.CreateHeightStructuresOutputEntity(registry)); + entity.HeightStructuresOutputEntities.Add(calculation.Output.Create(registry)); } return entity; Fisheye: Tag faeb56f2d76b07f370127de2beb66edad2dea6af refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructures/ProbabilityAssessmentOutputCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag fa2d88ba58e524c1d132a21df4e0adf9fa6570c4 refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/ProbabilityAssessmentOutputCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/IProbabilityAssessmentOutputEntity.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/IProbabilityAssessmentOutputEntity.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/IProbabilityAssessmentOutputEntity.cs (revision faeb56f2d76b07f370127de2beb66edad2dea6af) @@ -0,0 +1,54 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Application.Ringtoets.Storage.DbContext +{ + /// + /// Interface for an output entity that represents a probability assessment output. + /// + public interface IProbabilityAssessmentOutputEntity + { + /// + /// Sets the required (maximum allowed) probability of failure. + /// + double? RequiredProbability { set; } + + /// + /// Set the required (maximum allowed) reliability of the failure mechanism. + /// + double? RequiredReliability { set; } + + /// + /// Sets the probability of failure. + /// + double? Probability { set; } + + /// + /// Sets the reliability of the failure mechanism. + /// + double? Reliability { set; } + + /// + /// Sets the factor of safety of the failure mechanism. + /// + double? FactorOfSafety { set; } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/PartialHeightStructuresOutputEntity.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/PartialHeightStructuresOutputEntity.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/PartialHeightStructuresOutputEntity.cs (revision faeb56f2d76b07f370127de2beb66edad2dea6af) @@ -0,0 +1,29 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Application.Ringtoets.Storage.DbContext +{ + /// + /// Partial implementation of that implements + /// . + /// + public partial class HeightStructuresOutputEntity : IProbabilityAssessmentOutputEntity {} +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj =================================================================== diff -u -rfc8042d95d25d97f3e8a85fdd557771f718229f8 -rfaeb56f2d76b07f370127de2beb66edad2dea6af --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision fc8042d95d25d97f3e8a85fdd557771f718229f8) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision faeb56f2d76b07f370127de2beb66edad2dea6af) @@ -86,7 +86,7 @@ Code - + Fisheye: Tag faeb56f2d76b07f370127de2beb66edad2dea6af refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructures/ProbabilityAssessmentOutputCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/ProbabilityAssessmentOutputCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/ProbabilityAssessmentOutputCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/ProbabilityAssessmentOutputCreateExtensionsTest.cs (revision faeb56f2d76b07f370127de2beb66edad2dea6af) @@ -0,0 +1,101 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.DbContext; +using NUnit.Framework; +using Ringtoets.Common.Data.Probability; + +namespace Application.Ringtoets.Storage.Test.Create +{ + [TestFixture] + public class ProbabilityAssessmentOutputCreateExtensionsTest + { + [Test] + public void Create_PersistenceRegistryIsNull_ThrowArgumentNullException() + { + // Setup + var random = new Random(159); + var output = new ProbabilityAssessmentOutput(random.NextDouble(), random.NextDouble(), + random.NextDouble(), random.NextDouble(), + random.NextDouble()); + + // Call + TestDelegate call = () => output.Create(null); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("registry", paramName); + } + + [Test] + public void Create_ValidInput_ReturnProbabilityAssessmentOutputEntity() + { + // Setup + var random = new Random(456); + var output = new ProbabilityAssessmentOutput(random.NextDouble(), random.NextDouble(), + random.NextDouble(), random.NextDouble(), + random.NextDouble()); + + var registry = new PersistenceRegistry(); + + // Call + TestProbabilityAssessmentOutputEntity entity = output.Create(registry); + + // Assert + Assert.AreEqual(output.RequiredProbability, entity.RequiredProbability); + Assert.AreEqual(output.RequiredReliability.Value, entity.RequiredReliability); + Assert.AreEqual(output.Probability, entity.Probability); + Assert.AreEqual(output.Reliability.Value, entity.Reliability); + Assert.AreEqual(output.FactorOfSafety.Value, entity.FactorOfSafety); + } + + [Test] + public void Create_NaNValues_ReturnProbabilityAssessmentOutputEntity() + { + // Setup + var output = new ProbabilityAssessmentOutput(double.NaN, double.NaN, double.NaN, + double.NaN, double.NaN); + + var registry = new PersistenceRegistry(); + + // Call + TestProbabilityAssessmentOutputEntity entity = output.Create(registry); + + // Assert + Assert.IsNull(entity.RequiredProbability); + Assert.IsNull(entity.RequiredReliability); + Assert.IsNull(entity.Probability); + Assert.IsNull(entity.Reliability); + Assert.IsNull(entity.FactorOfSafety); + } + + private class TestProbabilityAssessmentOutputEntity : IProbabilityAssessmentOutputEntity + { + public double? RequiredProbability { get; set; } + public double? RequiredReliability { get; set; } + public double? Probability { get; set; } + public double? Reliability { get; set; } + public double? FactorOfSafety { get; set; } + } + } +} \ No newline at end of file