Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj =================================================================== diff -u -r44dbc30e3704795e6c88dd02296dc814eb4536bc -r880025e62153089b3f29c3c8becd500a13da3cde --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 44dbc30e3704795e6c88dd02296dc814eb4536bc) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 880025e62153089b3f29c3c8becd500a13da3cde) @@ -87,6 +87,7 @@ AssessmentSectionView.cs + Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/CombinedFailureMechanismSectionAssemblyResultRow.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/CombinedFailureMechanismSectionAssemblyResultRow.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/CombinedFailureMechanismSectionAssemblyResultRow.cs (revision 880025e62153089b3f29c3c8becd500a13da3cde) @@ -0,0 +1,306 @@ +// 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.ComponentModel; +using Core.Common.Util; +using Ringtoets.AssemblyTool.Data; +using Ringtoets.Integration.Data.Assembly; + +namespace Ringtoets.Integration.Forms.Views +{ + /// + /// This class represents a row displaying the properties of the . + /// + public class CombinedFailureMechanismSectionAssemblyResultRow + { + private readonly CombinedFailureMechanismSectionAssemblyResult combinedFailureMechanismSectionAssemblyResult; + + /// + /// Creates a new instance of . + /// + /// The + /// to wrap so that it can be displayed as a row. + /// Thrown when + /// is null. + public CombinedFailureMechanismSectionAssemblyResultRow(CombinedFailureMechanismSectionAssemblyResult combinedFailureMechanismSectionAssemblyResult) + { + if (combinedFailureMechanismSectionAssemblyResult == null) + { + throw new ArgumentNullException(nameof(combinedFailureMechanismSectionAssemblyResult)); + } + + this.combinedFailureMechanismSectionAssemblyResult = combinedFailureMechanismSectionAssemblyResult; + } + + /// + /// Gets the start of the section from the beginning of the reference line. + /// [m] + /// + public double SectionStart + { + get + { + return combinedFailureMechanismSectionAssemblyResult.SectionStart; + } + } + + /// + /// Gets the end of the section from the beginning of the reference line. + /// [m] + /// + public double SectionEnd + { + get + { + return combinedFailureMechanismSectionAssemblyResult.SectionEnd; + } + } + + /// + /// Gets the total assembly result. + /// + [TypeConverter(typeof(EnumTypeConverter))] + public FailureMechanismSectionAssemblyCategoryGroup TotalResult + { + get + { + return combinedFailureMechanismSectionAssemblyResult.TotalResult; + } + } + + /// + /// Gets the assembly result for piping. + /// + [TypeConverter(typeof(EnumTypeConverter))] + public FailureMechanismSectionAssemblyCategoryGroup Piping + { + get + { + return combinedFailureMechanismSectionAssemblyResult.Piping; + } + } + + /// + /// Gets the assembly result for grass cover erosion inwards. + /// + [TypeConverter(typeof(EnumTypeConverter))] + public FailureMechanismSectionAssemblyCategoryGroup GrassCoverErosionInwards + { + get + { + return combinedFailureMechanismSectionAssemblyResult.GrassCoverErosionInwards; + } + } + + /// + /// Gets the assembly result for macro stability inwards. + /// + [TypeConverter(typeof(EnumTypeConverter))] + public FailureMechanismSectionAssemblyCategoryGroup MacroStabilityInwards + { + get + { + return combinedFailureMechanismSectionAssemblyResult.MacroStabilityInwards; + } + } + + /// + /// Gets the assembly result for macro stability outwards. + /// + [TypeConverter(typeof(EnumTypeConverter))] + public FailureMechanismSectionAssemblyCategoryGroup MacroStabilityOutwards + { + get + { + return combinedFailureMechanismSectionAssemblyResult.MacroStabilityOutwards; + } + } + + /// + /// Gets the assembly result for microstability. + /// + [TypeConverter(typeof(EnumTypeConverter))] + public FailureMechanismSectionAssemblyCategoryGroup Microstability + { + get + { + return combinedFailureMechanismSectionAssemblyResult.Microstability; + } + } + + /// + /// Gets the assembly result for stability stone cover. + /// + [TypeConverter(typeof(EnumTypeConverter))] + public FailureMechanismSectionAssemblyCategoryGroup StabilityStoneCover + { + get + { + return combinedFailureMechanismSectionAssemblyResult.StabilityStoneCover; + } + } + + /// + /// Gets the assembly result for wave impact asphalt cover. + /// + [TypeConverter(typeof(EnumTypeConverter))] + public FailureMechanismSectionAssemblyCategoryGroup WaveImpactAsphaltCover + { + get + { + return combinedFailureMechanismSectionAssemblyResult.WaveImpactAsphaltCover; + } + } + + /// + /// Gets the assembly result for water pressure asphalt cover. + /// + [TypeConverter(typeof(EnumTypeConverter))] + public FailureMechanismSectionAssemblyCategoryGroup WaterPressureAsphaltCover + { + get + { + return combinedFailureMechanismSectionAssemblyResult.WaterPressureAsphaltCover; + } + } + + /// + /// Gets the assembly result for grass cover erosion outwards. + /// + [TypeConverter(typeof(EnumTypeConverter))] + public FailureMechanismSectionAssemblyCategoryGroup GrassCoverErosionOutwards + { + get + { + return combinedFailureMechanismSectionAssemblyResult.GrassCoverErosionOutwards; + } + } + + /// + /// Gets the assembly result for grass cover slip off outwards. + /// + [TypeConverter(typeof(EnumTypeConverter))] + public FailureMechanismSectionAssemblyCategoryGroup GrassCoverSlipOffOutwards + { + get + { + return combinedFailureMechanismSectionAssemblyResult.GrassCoverSlipOffOutwards; + } + } + + /// + /// Gets the assembly result for grass cover slip off inwards. + /// + [TypeConverter(typeof(EnumTypeConverter))] + public FailureMechanismSectionAssemblyCategoryGroup GrassCoverSlipOffInwards + { + get + { + return combinedFailureMechanismSectionAssemblyResult.GrassCoverSlipOffInwards; + } + } + + /// + /// Gets the assembly result for height structures. + /// + [TypeConverter(typeof(EnumTypeConverter))] + public FailureMechanismSectionAssemblyCategoryGroup HeightStructures + { + get + { + return combinedFailureMechanismSectionAssemblyResult.HeightStructures; + } + } + + /// + /// Gets the assembly result for closing structures. + /// + [TypeConverter(typeof(EnumTypeConverter))] + public FailureMechanismSectionAssemblyCategoryGroup ClosingStructures + { + get + { + return combinedFailureMechanismSectionAssemblyResult.ClosingStructures; + } + } + + /// + /// Gets the assembly result for piping structures. + /// + [TypeConverter(typeof(EnumTypeConverter))] + public FailureMechanismSectionAssemblyCategoryGroup PipingStructures + { + get + { + return combinedFailureMechanismSectionAssemblyResult.PipingStructures; + } + } + + /// + /// Gets the assembly result for stability point structures. + /// + [TypeConverter(typeof(EnumTypeConverter))] + public FailureMechanismSectionAssemblyCategoryGroup StabilityPointStructures + { + get + { + return combinedFailureMechanismSectionAssemblyResult.StabilityPointStructures; + } + } + + /// + /// Gets the assembly result for strength stability lengthwise. + /// + [TypeConverter(typeof(EnumTypeConverter))] + public FailureMechanismSectionAssemblyCategoryGroup StrengthStabilityLengthwise + { + get + { + return combinedFailureMechanismSectionAssemblyResult.StrengthStabilityLengthwise; + } + } + + /// + /// Gets the assembly result for dune erosion. + /// + [TypeConverter(typeof(EnumTypeConverter))] + public FailureMechanismSectionAssemblyCategoryGroup DuneErosion + { + get + { + return combinedFailureMechanismSectionAssemblyResult.DuneErosion; + } + } + + /// + /// Gets the assembly result for technical innovation. + /// + [TypeConverter(typeof(EnumTypeConverter))] + public FailureMechanismSectionAssemblyCategoryGroup TechnicalInnovation + { + get + { + return combinedFailureMechanismSectionAssemblyResult.TechnicalInnovation; + } + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj =================================================================== diff -u -r5f24b9f44bf75f735f6b9171ec6ce482fa0dcc7f -r880025e62153089b3f29c3c8becd500a13da3cde --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 5f24b9f44bf75f735f6b9171ec6ce482fa0dcc7f) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 880025e62153089b3f29c3c8becd500a13da3cde) @@ -70,6 +70,7 @@ + Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/CombinedFailureMechanismSectionAssemblyResultRowTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/CombinedFailureMechanismSectionAssemblyResultRowTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/CombinedFailureMechanismSectionAssemblyResultRowTest.cs (revision 880025e62153089b3f29c3c8becd500a13da3cde) @@ -0,0 +1,171 @@ +// 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 Core.Common.TestUtil; +using Core.Common.Util; +using NUnit.Framework; +using Ringtoets.AssemblyTool.Data; +using Ringtoets.Integration.Data.Assembly; +using Ringtoets.Integration.Forms.Views; + +namespace Ringtoets.Integration.Forms.Test.Views +{ + [TestFixture] + public class CombinedFailureMechanismSectionAssemblyResultRowTest + { + [Test] + public void Constructor_CombinedFailureMechanismAssemblyResultNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new CombinedFailureMechanismSectionAssemblyResultRow(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("combinedFailureMechanismSectionAssemblyResult", exception.ParamName); + } + + [Test] + public void Class_Always_ExpectedTypeConverters() + { + // Assert + TestHelper.AssertTypeConverter( + nameof(CombinedFailureMechanismSectionAssemblyResultRow.TotalResult)); + + TestHelper.AssertTypeConverter( + nameof(CombinedFailureMechanismSectionAssemblyResultRow.Piping)); + + TestHelper.AssertTypeConverter( + nameof(CombinedFailureMechanismSectionAssemblyResultRow.GrassCoverErosionInwards)); + + TestHelper.AssertTypeConverter( + nameof(CombinedFailureMechanismSectionAssemblyResultRow.MacroStabilityInwards)); + + TestHelper.AssertTypeConverter( + nameof(CombinedFailureMechanismSectionAssemblyResultRow.MacroStabilityOutwards)); + + TestHelper.AssertTypeConverter( + nameof(CombinedFailureMechanismSectionAssemblyResultRow.Microstability)); + + TestHelper.AssertTypeConverter( + nameof(CombinedFailureMechanismSectionAssemblyResultRow.StabilityStoneCover)); + + TestHelper.AssertTypeConverter( + nameof(CombinedFailureMechanismSectionAssemblyResultRow.WaveImpactAsphaltCover)); + + TestHelper.AssertTypeConverter( + nameof(CombinedFailureMechanismSectionAssemblyResultRow.WaterPressureAsphaltCover)); + + TestHelper.AssertTypeConverter( + nameof(CombinedFailureMechanismSectionAssemblyResultRow.GrassCoverErosionOutwards)); + + TestHelper.AssertTypeConverter( + nameof(CombinedFailureMechanismSectionAssemblyResultRow.GrassCoverSlipOffOutwards)); + + TestHelper.AssertTypeConverter( + nameof(CombinedFailureMechanismSectionAssemblyResultRow.GrassCoverSlipOffInwards)); + + TestHelper.AssertTypeConverter( + nameof(CombinedFailureMechanismSectionAssemblyResultRow.HeightStructures)); + + TestHelper.AssertTypeConverter( + nameof(CombinedFailureMechanismSectionAssemblyResultRow.ClosingStructures)); + + TestHelper.AssertTypeConverter( + nameof(CombinedFailureMechanismSectionAssemblyResultRow.PipingStructures)); + + TestHelper.AssertTypeConverter( + nameof(CombinedFailureMechanismSectionAssemblyResultRow.StabilityPointStructures)); + + TestHelper.AssertTypeConverter( + nameof(CombinedFailureMechanismSectionAssemblyResultRow.StrengthStabilityLengthwise)); + + TestHelper.AssertTypeConverter( + nameof(CombinedFailureMechanismSectionAssemblyResultRow.DuneErosion)); + + TestHelper.AssertTypeConverter( + nameof(CombinedFailureMechanismSectionAssemblyResultRow.TechnicalInnovation)); + } + + [Test] + public void Constructor_WithCombinedFailureMechanismAssemblyResult_ExpectedValues() + { + // Setup + CombinedFailureMechanismSectionAssemblyResult result = GetCombinedFailureMechanismSectionAssemblyResult(); + + // Call + var row = new CombinedFailureMechanismSectionAssemblyResultRow(result); + + // Assert + Assert.AreEqual(result.SectionStart, row.SectionStart); + Assert.AreEqual(result.SectionEnd, row.SectionEnd); + Assert.AreEqual(result.TotalResult, row.TotalResult); + Assert.AreEqual(result.Piping, row.Piping); + Assert.AreEqual(result.GrassCoverErosionInwards, row.GrassCoverErosionInwards); + Assert.AreEqual(result.MacroStabilityInwards, row.MacroStabilityInwards); + Assert.AreEqual(result.MacroStabilityOutwards, row.MacroStabilityOutwards); + Assert.AreEqual(result.Microstability, row.Microstability); + Assert.AreEqual(result.StabilityStoneCover, row.StabilityStoneCover); + Assert.AreEqual(result.WaveImpactAsphaltCover, row.WaveImpactAsphaltCover); + Assert.AreEqual(result.WaterPressureAsphaltCover, row.WaterPressureAsphaltCover); + Assert.AreEqual(result.GrassCoverErosionOutwards, row.GrassCoverErosionOutwards); + Assert.AreEqual(result.GrassCoverSlipOffOutwards, row.GrassCoverSlipOffOutwards); + Assert.AreEqual(result.GrassCoverSlipOffInwards, row.GrassCoverSlipOffInwards); + Assert.AreEqual(result.HeightStructures, row.HeightStructures); + Assert.AreEqual(result.ClosingStructures, row.ClosingStructures); + Assert.AreEqual(result.PipingStructures, row.PipingStructures); + Assert.AreEqual(result.StabilityPointStructures, row.StabilityPointStructures); + Assert.AreEqual(result.StrengthStabilityLengthwise, row.StrengthStabilityLengthwise); + Assert.AreEqual(result.DuneErosion, row.DuneErosion); + Assert.AreEqual(result.TechnicalInnovation, row.TechnicalInnovation); + } + + private static CombinedFailureMechanismSectionAssemblyResult GetCombinedFailureMechanismSectionAssemblyResult() + { + var random = new Random(21); + return new CombinedFailureMechanismSectionAssemblyResult( + random.NextDouble(), + random.NextDouble(), + random.NextEnumValue(), + new CombinedFailureMechanismSectionAssemblyResult.ConstructionProperties + { + Piping = random.NextEnumValue(), + GrassCoverErosionInwards = random.NextEnumValue(), + MacroStabilityInwards = random.NextEnumValue(), + MacroStabilityOutwards = random.NextEnumValue(), + Microstability = random.NextEnumValue(), + StabilityStoneCover = random.NextEnumValue(), + WaveImpactAsphaltCover = random.NextEnumValue(), + WaterPressureAsphaltCover = random.NextEnumValue(), + GrassCoverErosionOutwards = random.NextEnumValue(), + GrassCoverSlipOffOutwards = random.NextEnumValue(), + GrassCoverSlipOffInwards = random.NextEnumValue(), + HeightStructures = random.NextEnumValue(), + ClosingStructures = random.NextEnumValue(), + PipingStructures = random.NextEnumValue(), + StabilityPointStructures = random.NextEnumValue(), + StrengthStabilityLengthwise = random.NextEnumValue(), + DuneErosion = random.NextEnumValue(), + TechnicalInnovation = random.NextEnumValue() + }); + } + } +} \ No newline at end of file