Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj =================================================================== diff -u -r650fc7b43cb6729baee51d079f0377df8d7a3de9 -r99f5c8f535c01eb9882a703e09572ab4b5fe3d97 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 650fc7b43cb6729baee51d079f0377df8d7a3de9) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 99f5c8f535c01eb9882a703e09572ab4b5fe3d97) @@ -361,8 +361,8 @@ - - + + @@ -427,7 +427,7 @@ - + Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityInwards/MacroStabilityInwardsFailureMechanismCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityInwards/MacroStabilityInwardsFailureMechanismCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityInwards/MacroStabilityInwardsFailureMechanismCreateExtensions.cs (revision 99f5c8f535c01eb9882a703e09572ab4b5fe3d97) @@ -0,0 +1,61 @@ +// Copyright (C) Stichting Deltares 2017. 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 System.Collections.Generic; +using Application.Ringtoets.Storage.DbContext; +using Ringtoets.MacroStabilityInwards.Data; + +namespace Application.Ringtoets.Storage.Create.MacrostabilityInwards +{ + /// + /// Extension methods for related to creating a . + /// + internal static class MacroStabilityInwardsFailureMechanismCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The failure mechanism to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static FailureMechanismEntity Create(this MacroStabilityInwardsFailureMechanism mechanism, PersistenceRegistry registry) + { + FailureMechanismEntity entity = mechanism.Create(FailureMechanismType.MacroStabilityInwards, registry); + AddEntitiesForSectionResults(mechanism.SectionResults, registry); + + return entity; + } + + private static void AddEntitiesForSectionResults( + IEnumerable sectionResults, + PersistenceRegistry registry) + { + foreach (MacroStabilityInwardsFailureMechanismSectionResult failureMechanismSectionResult in sectionResults) + { + MacrostabilityInwardsSectionResultEntity sectionResultEntity = failureMechanismSectionResult.Create(); + FailureMechanismSectionEntity section = registry.Get(failureMechanismSectionResult.Section); + section.MacrostabilityInwardsSectionResultEntities.Add(sectionResultEntity); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityInwards/MacroStabilityInwardsFailureMechanismSectionResultCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityInwards/MacroStabilityInwardsFailureMechanismSectionResultCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityInwards/MacroStabilityInwardsFailureMechanismSectionResultCreateExtensions.cs (revision 99f5c8f535c01eb9882a703e09572ab4b5fe3d97) @@ -0,0 +1,50 @@ +// Copyright (C) Stichting Deltares 2017. 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 Ringtoets.MacroStabilityInwards.Data; + +namespace Application.Ringtoets.Storage.Create.MacrostabilityInwards +{ + /// + /// Extension methods for related to creating a + /// . + /// + internal static class MacroStabilityInwardsFailureMechanismSectionResultCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The result to create a database entity for. + /// A new . + internal static MacrostabilityInwardsSectionResultEntity Create(this MacroStabilityInwardsFailureMechanismSectionResult result) + { + var sectionResultEntity = new MacrostabilityInwardsSectionResultEntity + { + LayerOne = Convert.ToByte(result.AssessmentLayerOne), + LayerThree = result.AssessmentLayerThree.ToNaNAsNull() + }; + + return sectionResultEntity; + } + } +} \ No newline at end of file Fisheye: Tag 99f5c8f535c01eb9882a703e09572ab4b5fe3d97 refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 99f5c8f535c01eb9882a703e09572ab4b5fe3d97 refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismSectionResultCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/AssessmentSectionEntityReadExtensions.cs =================================================================== diff -u -r650fc7b43cb6729baee51d079f0377df8d7a3de9 -r99f5c8f535c01eb9882a703e09572ab4b5fe3d97 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/AssessmentSectionEntityReadExtensions.cs (.../AssessmentSectionEntityReadExtensions.cs) (revision 650fc7b43cb6729baee51d079f0377df8d7a3de9) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/AssessmentSectionEntityReadExtensions.cs (.../AssessmentSectionEntityReadExtensions.cs) (revision 99f5c8f535c01eb9882a703e09572ab4b5fe3d97) @@ -76,7 +76,7 @@ entity.ReadTechnicalInnovationFailureMechanism(assessmentSection, collector); entity.ReadWaterPressureAsphaltCoverFailureMechanism(assessmentSection, collector); entity.ReadClosingStructuresFailureMechanism(assessmentSection, collector); - entity.ReadMacrostabilityInwardsFailureMechanism(assessmentSection, collector); + entity.ReadMacroStabilityInwardsFailureMechanism(assessmentSection, collector); entity.ReadMacrostabilityOutwardsFailureMechanism(assessmentSection, collector); entity.ReadWaveImpactAsphaltCoverFailureMechanism(assessmentSection, collector); entity.ReadGrassCoverErosionOutwardsFailureMechanism(assessmentSection, collector); @@ -174,10 +174,10 @@ closingStructuresFailureMechanismEntity?.ReadAsClosingStructuresFailureMechanism(assessmentSection.ClosingStructures, collector); } - private static void ReadMacrostabilityInwardsFailureMechanism(this AssessmentSectionEntity entity, AssessmentSection assessmentSection, ReadConversionCollector collector) + private static void ReadMacroStabilityInwardsFailureMechanism(this AssessmentSectionEntity entity, AssessmentSection assessmentSection, ReadConversionCollector collector) { - FailureMechanismEntity macrostabilityInwardsFailureMechanismEntity = GetFailureMechanismEntityOfType(entity, FailureMechanismType.MacroStabilityInwards); - macrostabilityInwardsFailureMechanismEntity?.ReadAsMacroStabilityInwardsFailureMechanism(assessmentSection.MacroStabilityInwards, collector); + FailureMechanismEntity macroStabilityInwardsFailureMechanismEntity = GetFailureMechanismEntityOfType(entity, FailureMechanismType.MacroStabilityInwards); + macroStabilityInwardsFailureMechanismEntity?.ReadAsMacroStabilityInwardsFailureMechanism(assessmentSection.MacroStabilityInwards, collector); } private static void ReadMacrostabilityOutwardsFailureMechanism(this AssessmentSectionEntity entity, AssessmentSection assessmentSection, ReadConversionCollector collector) Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs =================================================================== diff -u -r650fc7b43cb6729baee51d079f0377df8d7a3de9 -r99f5c8f535c01eb9882a703e09572ab4b5fe3d97 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision 650fc7b43cb6729baee51d079f0377df8d7a3de9) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision 99f5c8f535c01eb9882a703e09572ab4b5fe3d97) @@ -500,10 +500,10 @@ ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); - entity.ReadMacrostabilityInwardsMechanismSectionResults(failureMechanism, collector); + entity.ReadMacroStabilityInwardsMechanismSectionResults(failureMechanism, collector); } - private static void ReadMacrostabilityInwardsMechanismSectionResults(this FailureMechanismEntity entity, + private static void ReadMacroStabilityInwardsMechanismSectionResults(this FailureMechanismEntity entity, MacroStabilityInwardsFailureMechanism failureMechanism, ReadConversionCollector collector) { Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwardsSectionResultEntityReadExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwardsSectionResultEntityReadExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwardsSectionResultEntityReadExtensions.cs (revision 99f5c8f535c01eb9882a703e09572ab4b5fe3d97) @@ -0,0 +1,55 @@ +// Copyright (C) Stichting Deltares 2017. 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 Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.MacroStabilityInwards.Data; + +namespace Application.Ringtoets.Storage.Read +{ + /// + /// This class defines extension methods for read operations for a based on the + /// . + /// + internal static class MacroStabilityInwardsSectionResultEntityReadExtensions + { + /// + /// Reads the and use the information to update a + /// . + /// + /// The to create for. + /// The target of the read operation. + /// A new . + /// Thrown when is null. + internal static void Read(this MacrostabilityInwardsSectionResultEntity entity, MacroStabilityInwardsFailureMechanismSectionResult sectionResult) + { + if (sectionResult == null) + { + throw new ArgumentNullException(nameof(sectionResult)); + } + + sectionResult.AssessmentLayerOne = (AssessmentLayerOneState) entity.LayerOne; + sectionResult.AssessmentLayerThree = (RoundedDouble) entity.LayerThree.ToNullAsNaN(); + } + } +} \ No newline at end of file Fisheye: Tag 99f5c8f535c01eb9882a703e09572ab4b5fe3d97 refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacrostabilityInwardsSectionResultEntityReadExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj =================================================================== diff -u -r650fc7b43cb6729baee51d079f0377df8d7a3de9 -r99f5c8f535c01eb9882a703e09572ab4b5fe3d97 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 650fc7b43cb6729baee51d079f0377df8d7a3de9) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 99f5c8f535c01eb9882a703e09572ab4b5fe3d97) @@ -154,8 +154,8 @@ - - + + @@ -222,7 +222,7 @@ - + Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityInwards/MacroStabilityInwardsFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityInwards/MacroStabilityInwardsFailureMechanismCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityInwards/MacroStabilityInwardsFailureMechanismCreateExtensionsTest.cs (revision 99f5c8f535c01eb9882a703e09572ab4b5fe3d97) @@ -0,0 +1,153 @@ +// Copyright (C) Stichting Deltares 2017. 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 System.Linq; +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.MacrostabilityInwards; +using Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.TestUtil; +using NUnit.Framework; +using Ringtoets.MacroStabilityInwards.Data; + +namespace Application.Ringtoets.Storage.Test.Create.MacrostabilityInwards +{ + [TestFixture] + public class MacroStabilityInwardsFailureMechanismCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + + // Call + TestDelegate test = () => failureMechanism.Create(null); + + // Assert + string paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("registry", paramName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant) + { + // Setup + var failureMechanism = new MacroStabilityInwardsFailureMechanism + { + IsRelevant = isRelevant, + InputComments = + { + Body = "Some input text" + }, + OutputComments = + { + Body = "Some output text" + }, + NotRelevantComments = + { + Body = "Really not relevant" + } + }; + var registry = new PersistenceRegistry(); + + // Call + FailureMechanismEntity entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual((short) FailureMechanismType.MacroStabilityInwards, entity.FailureMechanismType); + Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant); + Assert.AreEqual(failureMechanism.InputComments.Body, entity.InputComments); + Assert.AreEqual(failureMechanism.OutputComments.Body, entity.OutputComments); + Assert.AreEqual(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments); + } + + [Test] + public void Create_StringPropertiesDoNotShareReference() + { + // Setup + const string originalInput = "Some input text"; + const string originalOutput = "Some output text"; + const string originalNotRelevantText = "Really not relevant"; + var failureMechanism = new MacroStabilityInwardsFailureMechanism + { + InputComments = + { + Body = originalInput + }, + OutputComments = + { + Body = originalOutput + }, + NotRelevantComments = + { + Body = originalNotRelevantText + } + }; + var registry = new PersistenceRegistry(); + + // Call + FailureMechanismEntity entity = failureMechanism.Create(registry); + + // Assert + Assert.AreNotSame(originalInput, entity.InputComments, + "To create stable binary representations/fingerprints, it's really important that strings are not shared."); + Assert.AreEqual(failureMechanism.InputComments.Body, entity.InputComments); + Assert.AreNotSame(originalOutput, entity.OutputComments, + "To create stable binary representations/fingerprints, it's really important that strings are not shared."); + Assert.AreEqual(failureMechanism.OutputComments.Body, entity.OutputComments); + Assert.AreNotSame(originalNotRelevantText, entity.NotRelevantComments, + "To create stable binary representations/fingerprints, it's really important that strings are not shared."); + Assert.AreEqual(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments); + } + + [Test] + public void Create_WithoutSections_EmptyFailureMechanismSectionEntities() + { + // Setup + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + + // Call + FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.IsEmpty(entity.FailureMechanismSectionEntities); + } + + [Test] + public void Create_WithSections_FailureMechanismSectionEntitiesCreated() + { + // Setup + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + failureMechanism.AddSection(new TestFailureMechanismSection()); + + // Call + FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count); + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.MacrostabilityInwardsSectionResultEntities).Count()); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityInwards/MacroStabilityInwardsFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityInwards/MacroStabilityInwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityInwards/MacroStabilityInwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 99f5c8f535c01eb9882a703e09572ab4b5fe3d97) @@ -0,0 +1,75 @@ +// Copyright (C) Stichting Deltares 2017. 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.MacrostabilityInwards; +using Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.TestUtil; +using Core.Common.Base.Data; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.MacroStabilityInwards.Data; + +namespace Application.Ringtoets.Storage.Test.Create.MacrostabilityInwards +{ + [TestFixture] + public class MacroStabilityInwardsFailureMechanismSectionResultCreateExtensionsTest + { + [Test] + public void Create_WithResults_ReturnsEntityWithExpectedResults() + { + // Setup + var random = new Random(); + var assessmentLayerOneResult = random.NextEnumValue(); + const double assessmentLayerThreeResult = 3.2; + + var sectionResult = new MacroStabilityInwardsFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerOne = assessmentLayerOneResult, + AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + }; + + // Call + MacrostabilityInwardsSectionResultEntity result = sectionResult.Create(); + + // Assert + Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne); + Assert.AreEqual(assessmentLayerThreeResult, result.LayerThree); + } + + [Test] + public void Create_WithNaNLevel3Result_ReturnsEntityWithExpectedResults() + { + // Setup + var sectionResult = new MacroStabilityInwardsFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerThree = RoundedDouble.NaN + }; + + // Call + MacrostabilityInwardsSectionResultEntity result = sectionResult.Create(); + + // Assert + Assert.IsNull(result.LayerThree); + } + } +} \ No newline at end of file Fisheye: Tag 99f5c8f535c01eb9882a703e09572ab4b5fe3d97 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 99f5c8f535c01eb9882a703e09572ab4b5fe3d97 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismSectionResultCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs =================================================================== diff -u -r650fc7b43cb6729baee51d079f0377df8d7a3de9 -r99f5c8f535c01eb9882a703e09572ab4b5fe3d97 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs (.../AssessmentSectionEntityReadExtensionsTest.cs) (revision 650fc7b43cb6729baee51d079f0377df8d7a3de9) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs (.../AssessmentSectionEntityReadExtensionsTest.cs) (revision 99f5c8f535c01eb9882a703e09572ab4b5fe3d97) @@ -1168,7 +1168,7 @@ // Setup AssessmentSectionEntity entity = CreateAssessmentSectionEntity(); - FailureMechanismEntity macrostabilityInwards = CreateFailureMechanismEntity( + FailureMechanismEntity macroStabilityInwards = CreateFailureMechanismEntity( isRelevant, FailureMechanismType.MacroStabilityInwards); FailureMechanismEntity macrostabilityOutwards = CreateFailureMechanismEntity( isRelevant, FailureMechanismType.MacrostabilityOutwards); @@ -1185,7 +1185,7 @@ FailureMechanismEntity technicalInnovations = CreateFailureMechanismEntity( isRelevant, FailureMechanismType.TechnicalInnovations); - entity.FailureMechanismEntities.Add(macrostabilityInwards); + entity.FailureMechanismEntities.Add(macroStabilityInwards); entity.FailureMechanismEntities.Add(macrostabilityOutwards); entity.FailureMechanismEntities.Add(microstability); entity.FailureMechanismEntities.Add(strengthAndStabilityParallelConstruction); @@ -1201,8 +1201,8 @@ AssessmentSection section = entity.Read(collector); // Assert - AssertFailureMechanismEqual(isRelevant, 2, macrostabilityInwards.InputComments, - macrostabilityInwards.OutputComments, macrostabilityInwards.NotRelevantComments, + AssertFailureMechanismEqual(isRelevant, 2, macroStabilityInwards.InputComments, + macroStabilityInwards.OutputComments, macroStabilityInwards.NotRelevantComments, section.MacroStabilityInwards); AssertFailureMechanismEqual(isRelevant, 2, macrostabilityOutwards.InputComments, macrostabilityOutwards.OutputComments, macrostabilityOutwards.NotRelevantComments, Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwardsSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwardsSectionResultEntityReadExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwardsSectionResultEntityReadExtensionsTest.cs (revision 99f5c8f535c01eb9882a703e09572ab4b5fe3d97) @@ -0,0 +1,80 @@ +// Copyright (C) Stichting Deltares 2017. 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 Application.Ringtoets.Storage.Read; +using Application.Ringtoets.Storage.TestUtil; +using NUnit.Framework; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.MacroStabilityInwards.Data; + +namespace Application.Ringtoets.Storage.Test.Read +{ + [TestFixture] + public class MacrostabilityInwardsSectionResultEntityReadExtensionsTest + { + [Test] + public void Read_SectionResultIsNull_ThrowArgumentNullException() + { + // Setup + var entity = new MacrostabilityInwardsSectionResultEntity(); + + // Call + TestDelegate call = () => entity.Read(null); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("sectionResult", paramName); + } + + [Test] + [Combinatorial] + public void Read_ParameterValues_SectionResultWithParameterValues( + [Values(AssessmentLayerOneState.NotAssessed, AssessmentLayerOneState.NoVerdict, + AssessmentLayerOneState.Sufficient)] AssessmentLayerOneState layerOne, + [Values(0.1, 0.2, null)] double? layerTwoA, + [Values(0.11, 0.22, null)] double? layerThree) + { + // Setup + var collector = new ReadConversionCollector(); + + var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); + collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); + var entity = new MacrostabilityInwardsSectionResultEntity + { + LayerThree = layerThree, + LayerTwoA = layerTwoA, + LayerOne = Convert.ToByte(layerOne), + FailureMechanismSectionEntity = failureMechanismSectionEntity + }; + var sectionResult = new MacroStabilityInwardsFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult); + + // Assert + Assert.IsNotNull(sectionResult); + Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); + Assert.AreEqual(layerThree ?? double.NaN, sectionResult.AssessmentLayerThree, 1e-6); + } + } +} \ No newline at end of file Fisheye: Tag 99f5c8f535c01eb9882a703e09572ab4b5fe3d97 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacrostabilityInwardsSectionResultEntityReadExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff?