Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj =================================================================== diff -u -rfaeb56f2d76b07f370127de2beb66edad2dea6af -r9e54793f4e953bf1a1b9c9f9d731de4831dd9ff6 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision faeb56f2d76b07f370127de2beb66edad2dea6af) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 9e54793f4e953bf1a1b9c9f9d731de4831dd9ff6) @@ -260,8 +260,8 @@ - + Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/IProbabilityAssessmentOutputEntity.cs =================================================================== diff -u -rfaeb56f2d76b07f370127de2beb66edad2dea6af -r9e54793f4e953bf1a1b9c9f9d731de4831dd9ff6 --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/IProbabilityAssessmentOutputEntity.cs (.../IProbabilityAssessmentOutputEntity.cs) (revision faeb56f2d76b07f370127de2beb66edad2dea6af) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/IProbabilityAssessmentOutputEntity.cs (.../IProbabilityAssessmentOutputEntity.cs) (revision 9e54793f4e953bf1a1b9c9f9d731de4831dd9ff6) @@ -27,28 +27,28 @@ public interface IProbabilityAssessmentOutputEntity { /// - /// Sets the required (maximum allowed) probability of failure. + /// Gets or sets the required (maximum allowed) probability of failure. /// - double? RequiredProbability { set; } + double? RequiredProbability { get; set; } /// - /// Set the required (maximum allowed) reliability of the failure mechanism. + /// Gets or set the required (maximum allowed) reliability of the failure mechanism. /// - double? RequiredReliability { set; } + double? RequiredReliability { get; set; } /// - /// Sets the probability of failure. + /// Gets or sets the probability of failure. /// - double? Probability { set; } + double? Probability { get; set; } /// - /// Sets the reliability of the failure mechanism. + /// Gets or sets the reliability of the failure mechanism. /// - double? Reliability { set; } + double? Reliability { get; set; } /// - /// Sets the factor of safety of the failure mechanism. + /// Gets or sets the factor of safety of the failure mechanism. /// - double? FactorOfSafety { set; } + double? FactorOfSafety { get; set; } } } \ No newline at end of file Fisheye: Tag 9e54793f4e953bf1a1b9c9f9d731de4831dd9ff6 refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/HeightStructures/HeightStructuresOutputEntityReadExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/IProbabilityAssessmentOutputEntityReadExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/IProbabilityAssessmentOutputEntityReadExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/IProbabilityAssessmentOutputEntityReadExtensions.cs (revision 9e54793f4e953bf1a1b9c9f9d731de4831dd9ff6) @@ -0,0 +1,49 @@ +// 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 Application.Ringtoets.Storage.DbContext; +using Ringtoets.Common.Data.Probability; + +namespace Application.Ringtoets.Storage.Read +{ + /// + /// Extension methods for related to creating a + /// . + /// + internal static class IProbabilityAssessmentOutputEntityReadExtensions + { + /// + /// Reads the + /// and use the information to construct a . + /// + /// The + /// to create for. + /// A new . + internal static ProbabilityAssessmentOutput Read(this IProbabilityAssessmentOutputEntity entity) + { + return new ProbabilityAssessmentOutput(entity.RequiredProbability.ToNullAsNaN(), + entity.RequiredReliability.ToNullAsNaN(), + entity.Probability.ToNullAsNaN(), + entity.Reliability.ToNullAsNaN(), + entity.FactorOfSafety.ToNullAsNaN()); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj =================================================================== diff -u -rfaeb56f2d76b07f370127de2beb66edad2dea6af -r9e54793f4e953bf1a1b9c9f9d731de4831dd9ff6 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision faeb56f2d76b07f370127de2beb66edad2dea6af) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 9e54793f4e953bf1a1b9c9f9d731de4831dd9ff6) @@ -101,7 +101,7 @@ - + Fisheye: Tag 9e54793f4e953bf1a1b9c9f9d731de4831dd9ff6 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/HeightStructures/HeightStructuresOutputEntityReadExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/IProbabilityAssessmentOutputEntityReadExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/IProbabilityAssessmentOutputEntityReadExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/IProbabilityAssessmentOutputEntityReadExtensionsTest.cs (revision 9e54793f4e953bf1a1b9c9f9d731de4831dd9ff6) @@ -0,0 +1,98 @@ +// 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.DbContext; +using Core.Common.Base.Data; +using NUnit.Framework; +using Ringtoets.Common.Data.Probability; +using Ringtoets.Common.Data.TestUtil; +using Application.Ringtoets.Storage.Read; + +namespace Application.Ringtoets.Storage.Test.Read +{ + [TestFixture] + public class IProbabilityAssessmentOutputEntityReadExtensionsTest + { + [Test] + public void Read_ValidEntity_ReturnProbabilityAssessmentOutput() + { + // Setup + var random = new Random(159); + var entity = new TestProbabilityAssessmentOutputEntity + { + RequiredProbability = random.NextDouble(), + RequiredReliability = random.NextDouble(), + Probability = random.NextDouble(), + Reliability = random.NextDouble(), + FactorOfSafety = random.NextDouble() + }; + + // Call + ProbabilityAssessmentOutput output = entity.Read(); + + // Assert + Assert.AreEqual(entity.RequiredProbability, output.RequiredProbability); + AssertRoundedDouble(entity.RequiredReliability, output.RequiredReliability); + Assert.AreEqual(entity.Probability, output.Probability); + AssertRoundedDouble(entity.Reliability, output.Reliability); + AssertRoundedDouble(entity.FactorOfSafety, output.FactorOfSafety); + } + + [Test] + public void Read_ValidEntityWithNullValues_ReturnProbabilityAssessmentOutput() + { + // Setup + var entity = new TestProbabilityAssessmentOutputEntity + { + RequiredProbability = null, + RequiredReliability = null, + Probability = null, + Reliability = null, + FactorOfSafety = null + }; + + // Call + ProbabilityAssessmentOutput output = entity.Read(); + + // Assert + Assert.IsNaN(output.RequiredProbability); + Assert.IsNaN(output.RequiredReliability.Value); + Assert.IsNaN(output.Probability); + Assert.IsNaN(output.Reliability.Value); + Assert.IsNaN(output.FactorOfSafety.Value); + } + + 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; } + } + + private static void AssertRoundedDouble(double? expectedValue, RoundedDouble actualValue) + { + Assert.AreEqual((RoundedDouble)expectedValue.ToNullAsNaN(), actualValue, actualValue.GetAccuracy()); + } + } +} \ No newline at end of file