Index: Riskeer/Storage/src/Riskeer.Storage.Core/Create/IHasGeneralInputCreateExtensions.cs =================================================================== diff -u -r5c7c300303ade7d9881903b36480787c7e6f2886 -r4a30010f07d9dca39e1066d7d2871e0ba74e2e67 --- Riskeer/Storage/src/Riskeer.Storage.Core/Create/IHasGeneralInputCreateExtensions.cs (.../IHasGeneralInputCreateExtensions.cs) (revision 5c7c300303ade7d9881903b36480787c7e6f2886) +++ Riskeer/Storage/src/Riskeer.Storage.Core/Create/IHasGeneralInputCreateExtensions.cs (.../IHasGeneralInputCreateExtensions.cs) (revision 4a30010f07d9dca39e1066d7d2871e0ba74e2e67) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using Riskeer.Common.Data.FailureMechanism; using Riskeer.Storage.Core.DbContext; @@ -42,7 +43,8 @@ { return new TFailureMechanismMetaEntity { - N = mechanism.GeneralInput.N + N = mechanism.GeneralInput.N, + ApplyLengthEffectInSection = Convert.ToByte(mechanism.GeneralInput.ApplyLengthEffectInSection) }; } } Index: Riskeer/Storage/src/Riskeer.Storage.Core/Create/StrengthStabilityLengthwise/StrengthStabilityLengthwiseConstructionFailureMechanismCreateExtensions.cs =================================================================== diff -u -r521d10695326519942a95db0d8746da32c586668 -r4a30010f07d9dca39e1066d7d2871e0ba74e2e67 --- Riskeer/Storage/src/Riskeer.Storage.Core/Create/StrengthStabilityLengthwise/StrengthStabilityLengthwiseConstructionFailureMechanismCreateExtensions.cs (.../StrengthStabilityLengthwiseConstructionFailureMechanismCreateExtensions.cs) (revision 521d10695326519942a95db0d8746da32c586668) +++ Riskeer/Storage/src/Riskeer.Storage.Core/Create/StrengthStabilityLengthwise/StrengthStabilityLengthwiseConstructionFailureMechanismCreateExtensions.cs (.../StrengthStabilityLengthwiseConstructionFailureMechanismCreateExtensions.cs) (revision 4a30010f07d9dca39e1066d7d2871e0ba74e2e67) @@ -62,8 +62,10 @@ private static void AddEntitiesForFailureMechanismMeta(StrengthStabilityLengthwiseConstructionFailureMechanism mechanism, FailureMechanismEntity entity) { - entity.StrengthStabilityLengthwiseConstructionFailureMechanismMetaEntities.Add( - mechanism.Create()); + entity.StrengthStabilityLengthwiseConstructionFailureMechanismMetaEntities.Add(new StrengthStabilityLengthwiseConstructionFailureMechanismMetaEntity + { + N = mechanism.GeneralInput.N + }); } } } \ No newline at end of file Index: Riskeer/Storage/src/Riskeer.Storage.Core/DbContext/Interfaces/IStandAloneFailureMechanismMetaEntity.cs =================================================================== diff -u -rb0659134a0667f5f57838c57b9be8f436fdf3640 -r4a30010f07d9dca39e1066d7d2871e0ba74e2e67 --- Riskeer/Storage/src/Riskeer.Storage.Core/DbContext/Interfaces/IStandAloneFailureMechanismMetaEntity.cs (.../IStandAloneFailureMechanismMetaEntity.cs) (revision b0659134a0667f5f57838c57b9be8f436fdf3640) +++ Riskeer/Storage/src/Riskeer.Storage.Core/DbContext/Interfaces/IStandAloneFailureMechanismMetaEntity.cs (.../IStandAloneFailureMechanismMetaEntity.cs) (revision 4a30010f07d9dca39e1066d7d2871e0ba74e2e67) @@ -30,5 +30,10 @@ /// Gets or sets the 'N' parameter used to factor in the 'length effect'. /// double N { get; set; } + + /// + /// Gets or sets the whether the length effect should be applies in the section. + /// + byte ApplyLengthEffectInSection { get; set; } } } \ No newline at end of file Fisheye: Tag 4a30010f07d9dca39e1066d7d2871e0ba74e2e67 refers to a dead (removed) revision in file `Riskeer/Storage/src/Riskeer.Storage.Core/DbContext/Partials/PartialStrengthAndStabilityParallelConstructionFailureMechanismMetaEntity.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Storage/src/Riskeer.Storage.Core/DbContext/StrengthStabilityLengthwiseConstructionFailureMechanismMetaEntity.cs =================================================================== diff -u -rcbeec5478697e7ac0b1d16cb5217b22c8bdf572f -r4a30010f07d9dca39e1066d7d2871e0ba74e2e67 --- Riskeer/Storage/src/Riskeer.Storage.Core/DbContext/StrengthStabilityLengthwiseConstructionFailureMechanismMetaEntity.cs (.../StrengthStabilityLengthwiseConstructionFailureMechanismMetaEntity.cs) (revision cbeec5478697e7ac0b1d16cb5217b22c8bdf572f) +++ Riskeer/Storage/src/Riskeer.Storage.Core/DbContext/StrengthStabilityLengthwiseConstructionFailureMechanismMetaEntity.cs (.../StrengthStabilityLengthwiseConstructionFailureMechanismMetaEntity.cs) (revision 4a30010f07d9dca39e1066d7d2871e0ba74e2e67) @@ -30,7 +30,7 @@ namespace Riskeer.Storage.Core.DbContext { - public partial class StrengthStabilityLengthwiseConstructionFailureMechanismMetaEntity + public class StrengthStabilityLengthwiseConstructionFailureMechanismMetaEntity { public long StrengthStabilityLengthwiseConstructionFailureMechanismMetaEntityId { get; set; } public long FailureMechanismEntityId { get; set; } Index: Riskeer/Storage/src/Riskeer.Storage.Core/Read/StandAloneFailureMechanismMetaEntityReadExtensions.cs =================================================================== diff -u -ra36c54b05d73f9822ba617e87eca164be15e72bb -r4a30010f07d9dca39e1066d7d2871e0ba74e2e67 --- Riskeer/Storage/src/Riskeer.Storage.Core/Read/StandAloneFailureMechanismMetaEntityReadExtensions.cs (.../StandAloneFailureMechanismMetaEntityReadExtensions.cs) (revision a36c54b05d73f9822ba617e87eca164be15e72bb) +++ Riskeer/Storage/src/Riskeer.Storage.Core/Read/StandAloneFailureMechanismMetaEntityReadExtensions.cs (.../StandAloneFailureMechanismMetaEntityReadExtensions.cs) (revision 4a30010f07d9dca39e1066d7d2871e0ba74e2e67) @@ -32,6 +32,7 @@ } generalInput.N = (RoundedDouble) entity.N; + generalInput.ApplyLengthEffectInSection = Convert.ToBoolean(entity.ApplyLengthEffectInSection); } } } \ No newline at end of file Index: Riskeer/Storage/src/Riskeer.Storage.Core/Read/StrengthStabilityLengthwiseConstructionFailureMechanismEntityReadExtensions.cs =================================================================== diff -u --- Riskeer/Storage/src/Riskeer.Storage.Core/Read/StrengthStabilityLengthwiseConstructionFailureMechanismEntityReadExtensions.cs (revision 0) +++ Riskeer/Storage/src/Riskeer.Storage.Core/Read/StrengthStabilityLengthwiseConstructionFailureMechanismEntityReadExtensions.cs (revision 4a30010f07d9dca39e1066d7d2871e0ba74e2e67) @@ -0,0 +1,37 @@ +using System; +using Core.Common.Base.Data; +using Riskeer.Common.Data.FailureMechanism; +using Riskeer.Storage.Core.DbContext; + +namespace Riskeer.Storage.Core.Read +{ + /// + /// This class defines extension methods for read operations for a + /// based on the . + /// + internal static class StrengthStabilityLengthwiseConstructionFailureMechanismMetaEntityReadExtensions + { + /// + /// Read the and use the information to + /// update the . + /// + /// The to update + /// for. + /// The to update. + /// Thrown when any parameter is null. + internal static void Read(this StrengthStabilityLengthwiseConstructionFailureMechanismMetaEntity entity, GeneralInput generalInput) + { + if (entity == null) + { + throw new ArgumentNullException(nameof(entity)); + } + + if (generalInput == null) + { + throw new ArgumentNullException(nameof(generalInput)); + } + + generalInput.N = (RoundedDouble) entity.N; + } + } +} \ No newline at end of file Index: Riskeer/Storage/test/Riskeer.Storage.Core.Test/Create/IHasGeneralInputCreateExtensionsTest.cs =================================================================== diff -u -r15b8505903b35bfd9de95fb36d13ef9eaa93fc0a -r4a30010f07d9dca39e1066d7d2871e0ba74e2e67 --- Riskeer/Storage/test/Riskeer.Storage.Core.Test/Create/IHasGeneralInputCreateExtensionsTest.cs (.../IHasGeneralInputCreateExtensionsTest.cs) (revision 15b8505903b35bfd9de95fb36d13ef9eaa93fc0a) +++ Riskeer/Storage/test/Riskeer.Storage.Core.Test/Create/IHasGeneralInputCreateExtensionsTest.cs (.../IHasGeneralInputCreateExtensionsTest.cs) (revision 4a30010f07d9dca39e1066d7d2871e0ba74e2e67) @@ -35,11 +35,13 @@ public void Create_WithAllData_SetsMetaEntityProperties() { // Setup + var random = new Random(); var failureMechanism = new TestFailureMechanism { GeneralInput = { - N = new Random().NextRoundedDouble(1, 20) + N = random.NextRoundedDouble(1, 20), + ApplyLengthEffectInSection = random.NextBoolean() } }; @@ -49,11 +51,13 @@ // Assert Assert.IsInstanceOf(metaEntity); Assert.AreEqual(failureMechanism.GeneralInput.N, metaEntity.N); + Assert.AreEqual(Convert.ToByte(failureMechanism.GeneralInput.ApplyLengthEffectInSection), metaEntity.ApplyLengthEffectInSection); } private class TestFailureMechanismMetaEntity : IStandAloneFailureMechanismMetaEntity { public double N { get; set; } + public byte ApplyLengthEffectInSection { get; set; } } } } \ No newline at end of file Index: Riskeer/Storage/test/Riskeer.Storage.Core.Test/Read/StandAloneFailureMechanismMetaEntityReadExtensionsTest.cs =================================================================== diff -u -r49bb18fa968cd0ce2fdb8197afb4d3beb63f7dea -r4a30010f07d9dca39e1066d7d2871e0ba74e2e67 --- Riskeer/Storage/test/Riskeer.Storage.Core.Test/Read/StandAloneFailureMechanismMetaEntityReadExtensionsTest.cs (.../StandAloneFailureMechanismMetaEntityReadExtensionsTest.cs) (revision 49bb18fa968cd0ce2fdb8197afb4d3beb63f7dea) +++ Riskeer/Storage/test/Riskeer.Storage.Core.Test/Read/StandAloneFailureMechanismMetaEntityReadExtensionsTest.cs (.../StandAloneFailureMechanismMetaEntityReadExtensionsTest.cs) (revision 4a30010f07d9dca39e1066d7d2871e0ba74e2e67) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using Core.Common.TestUtil; using NUnit.Framework; using Rhino.Mocks; using Riskeer.Common.Data.FailureMechanism; @@ -65,18 +66,21 @@ public void Read_WithAllData_SetsGeneralInputProperties() { // Setup + var random = new Random(); var mocks = new MockRepository(); var entity = mocks.Stub(); mocks.ReplayAll(); - entity.N = 4.0; + entity.N = random.NextDouble(1, 20); + entity.ApplyLengthEffectInSection = Convert.ToByte(random.NextBoolean()); var generalInput = new GeneralInput(); // Call entity.Read(generalInput); // Assert Assert.AreEqual(entity.N, generalInput.N, generalInput.N.GetAccuracy()); + Assert.AreEqual(Convert.ToBoolean(entity.ApplyLengthEffectInSection), generalInput.ApplyLengthEffectInSection); mocks.VerifyAll(); } Index: Riskeer/Storage/test/Riskeer.Storage.Core.Test/Read/StrengthStabilityLengthwiseConstructionFailureMechanismMetaEntityReadExtensionsTest.cs =================================================================== diff -u --- Riskeer/Storage/test/Riskeer.Storage.Core.Test/Read/StrengthStabilityLengthwiseConstructionFailureMechanismMetaEntityReadExtensionsTest.cs (revision 0) +++ Riskeer/Storage/test/Riskeer.Storage.Core.Test/Read/StrengthStabilityLengthwiseConstructionFailureMechanismMetaEntityReadExtensionsTest.cs (revision 4a30010f07d9dca39e1066d7d2871e0ba74e2e67) @@ -0,0 +1,72 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer 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 NUnit.Framework; +using Riskeer.Common.Data.FailureMechanism; +using Riskeer.Common.Data.TestUtil; +using Riskeer.Storage.Core.DbContext; +using Riskeer.Storage.Core.Read; + +namespace Riskeer.Storage.Core.Test.Read +{ + [TestFixture] + public class StrengthStabilityLengthwiseConstructionFailureMechanismMetaEntityReadExtensionsTest + { + [Test] + public void Read_EntityNull_ThrowsArgumentNullException() + { + // Call + void Call() => ((StrengthStabilityLengthwiseConstructionFailureMechanismMetaEntity) null).Read(new GeneralInput()); + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("entity", exception.ParamName); + } + + [Test] + public void Read_GeneralInputNull_ThrowsArgumentNullException() + { + // Call + void Call() => new StrengthStabilityLengthwiseConstructionFailureMechanismMetaEntity().Read(null); + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("generalInput", exception.ParamName); + } + + [Test] + public void Read_WithAllData_SetsGeneralInputProperties() + { + // Setup + var entity = new StrengthStabilityLengthwiseConstructionFailureMechanismMetaEntity(); + + entity.N = 4.0; + var generalInput = new GeneralInput(); + + // Call + entity.Read(generalInput); + + // Assert + Assert.AreEqual(entity.N, generalInput.N, generalInput.N.GetAccuracy()); + } + } +} \ No newline at end of file