Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/Enums/AssemblyXmlEnumIdentifiers.cs =================================================================== diff -u -r5e2248b589fcb4b39e7ff664cd11a200b08daa28 -rfb23c7e9b2fde4f4439e758e56ae5ed957385a71 --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/Enums/AssemblyXmlEnumIdentifiers.cs (.../AssemblyXmlEnumIdentifiers.cs) (revision 5e2248b589fcb4b39e7ff664cd11a200b08daa28) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/Enums/AssemblyXmlEnumIdentifiers.cs (.../AssemblyXmlEnumIdentifiers.cs) (revision fb23c7e9b2fde4f4439e758e56ae5ed957385a71) @@ -399,5 +399,19 @@ public const string SerializableAssessmentLevelCombinedSectionAssessment = "GECBNTRDV"; #endregion + + #region SerializableFailureMechanismSectionType + + /// + /// Identifier for . + /// + public const string SerializableFailureMechanismSectionTypeFailureMechanism = "TOETSSSTE"; + + /// + /// Identifier for . + /// + public const string SerializableFailureMechanismSectionTypeCombined = "GECBNETSSTE"; + + #endregion } } \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/Enums/SerializableFailureMechanismSectionType.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/Enums/SerializableFailureMechanismSectionType.cs (revision 0) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/Enums/SerializableFailureMechanismSectionType.cs (revision fb23c7e9b2fde4f4439e758e56ae5ed957385a71) @@ -0,0 +1,43 @@ +// 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.Xml.Serialization; + +namespace Ringtoets.AssemblyTool.IO.Model.Enums +{ + /// + /// Serializable enum defining failure mechanism section types. + /// + public enum SerializableFailureMechanismSectionType + { + /// + /// Represents a failure mechanism section. + /// + [XmlEnum(AssemblyXmlEnumIdentifiers.SerializableFailureMechanismSectionTypeFailureMechanism)] + FailureMechanism = 1, + + /// + /// Represents a combined failure mechanism section. + /// + [XmlEnum(AssemblyXmlEnumIdentifiers.SerializableFailureMechanismSectionTypeCombined)] + Combined = 2, + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableFailureMechanismSection.cs =================================================================== diff -u -r2a28064a44daa277c25e597f4b3eea1edd52e37c -rfb23c7e9b2fde4f4439e758e56ae5ed957385a71 --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableFailureMechanismSection.cs (.../SerializableFailureMechanismSection.cs) (revision 2a28064a44daa277c25e597f4b3eea1edd52e37c) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableFailureMechanismSection.cs (.../SerializableFailureMechanismSection.cs) (revision fb23c7e9b2fde4f4439e758e56ae5ed957385a71) @@ -38,10 +38,7 @@ /// /// Creates a new instance of . /// - public SerializableFailureMechanismSection() - { - FailureMechanismSectionType = Resources.FailureMechanismSectionType_FailureMechanism; - } + public SerializableFailureMechanismSection() {} /// /// Creates a new instance of . @@ -51,14 +48,17 @@ /// The distance over the reference line where this section starts in meters. /// The distance over the reference line where this section ends in meters. /// The geometry of the section. + /// The type of the section. /// The assembly method used to create this section. - /// Thrown when any parameter is null. + /// Thrown when , , + /// or is null. public SerializableFailureMechanismSection(string id, SerializableFailureMechanismSectionCollection failureMechanismSectionCollection, double startDistance, double endDistance, IEnumerable geometry, - SerializableAssemblyMethod? assemblyMethod = null) : this() + SerializableFailureMechanismSectionType sectionType, + SerializableAssemblyMethod? assemblyMethod = null) { if (id == null) { @@ -82,6 +82,7 @@ Geometry = new SerializableLine(geometry); Length = new SerializableMeasure("m", Math2D.Length(geometry)); AssemblyMethod = assemblyMethod; + FailureMechanismSectionType = sectionType; } /// @@ -124,7 +125,7 @@ /// Gets or sets the section type. /// [XmlElement(AssemblyXmlIdentifiers.FailureMechanismSectionType)] - public string FailureMechanismSectionType { get; set; } + public SerializableFailureMechanismSectionType FailureMechanismSectionType { get; set; } /// /// Gets or sets the assembly method used to create this section. Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Properties/Resources.Designer.cs =================================================================== diff -u -r5c59e60cae7bc68b321c0ee187a7d4dd9dd753b2 -rfb23c7e9b2fde4f4439e758e56ae5ed957385a71 --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 5c59e60cae7bc68b321c0ee187a7d4dd9dd753b2) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision fb23c7e9b2fde4f4439e758e56ae5ed957385a71) @@ -100,24 +100,6 @@ } /// - /// Looks up a localized string similar to GECBNETSSTE. - /// - internal static string FailureMechanismSectionType_Combined { - get { - return ResourceManager.GetString("FailureMechanismSectionType_Combined", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to TOETSSSTE. - /// - internal static string FailureMechanismSectionType_FailureMechanism { - get { - return ResourceManager.GetString("FailureMechanismSectionType_FailureMechanism", resourceCulture); - } - } - - /// /// Looks up a localized string similar to VOLLDG. /// internal static string FullAssembly { Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Properties/Resources.resx =================================================================== diff -u -r5c59e60cae7bc68b321c0ee187a7d4dd9dd753b2 -rfb23c7e9b2fde4f4439e758e56ae5ed957385a71 --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Properties/Resources.resx (.../Resources.resx) (revision 5c59e60cae7bc68b321c0ee187a7d4dd9dd753b2) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Properties/Resources.resx (.../Resources.resx) (revision fb23c7e9b2fde4f4439e758e56ae5ed957385a71) @@ -123,12 +123,6 @@ DIRECT - - GECBNETSSTE - - - TOETSSSTE - VOLLDG Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Ringtoets.AssemblyTool.IO.csproj =================================================================== diff -u -r2a28064a44daa277c25e597f4b3eea1edd52e37c -rfb23c7e9b2fde4f4439e758e56ae5ed957385a71 --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Ringtoets.AssemblyTool.IO.csproj (.../Ringtoets.AssemblyTool.IO.csproj) (revision 2a28064a44daa277c25e597f4b3eea1edd52e37c) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Ringtoets.AssemblyTool.IO.csproj (.../Ringtoets.AssemblyTool.IO.csproj) (revision fb23c7e9b2fde4f4439e758e56ae5ed957385a71) @@ -22,6 +22,7 @@ + Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/Enums/AssemblyXmlEnumIdentifiersTest.cs =================================================================== diff -u -r89fbfe6eb9c1a0778dfc25531b2bf139aa454fe3 -rfb23c7e9b2fde4f4439e758e56ae5ed957385a71 --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/Enums/AssemblyXmlEnumIdentifiersTest.cs (.../AssemblyXmlEnumIdentifiersTest.cs) (revision 89fbfe6eb9c1a0778dfc25531b2bf139aa454fe3) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/Enums/AssemblyXmlEnumIdentifiersTest.cs (.../AssemblyXmlEnumIdentifiersTest.cs) (revision fb23c7e9b2fde4f4439e758e56ae5ed957385a71) @@ -106,6 +106,9 @@ Assert.AreEqual("TOETSOPMT", AssemblyXmlEnumIdentifiers.SerializableAssessmentLevelTailorMadeAssessment); Assert.AreEqual("GECBNTR", AssemblyXmlEnumIdentifiers.SerializableAssessmentLevelCombinedAssessment); Assert.AreEqual("GECBNTRDV", AssemblyXmlEnumIdentifiers.SerializableAssessmentLevelCombinedSectionAssessment); + + Assert.AreEqual("TOETSSSTE", AssemblyXmlEnumIdentifiers.SerializableFailureMechanismSectionTypeFailureMechanism); + Assert.AreEqual("GECBNETSSTE", AssemblyXmlEnumIdentifiers.SerializableFailureMechanismSectionTypeCombined); } } } \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/Enums/SerializableFailureMechanismSectionTypeTest.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/Enums/SerializableFailureMechanismSectionTypeTest.cs (revision 0) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/Enums/SerializableFailureMechanismSectionTypeTest.cs (revision fb23c7e9b2fde4f4439e758e56ae5ed957385a71) @@ -0,0 +1,64 @@ +// 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.Collections.Generic; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.AssemblyTool.IO.Model.Enums; + +namespace Ringtoets.AssemblyTool.IO.Test.Model.Enums +{ + [TestFixture] + public class SerializableFailureMechanismSectionTypeTest : EnumWithXmlEnumNameTestFixture + { + protected override IDictionary ExpectedValueForEnumValues + { + get + { + return new Dictionary + { + { + SerializableFailureMechanismSectionType.FailureMechanism, 1 + }, + { + SerializableFailureMechanismSectionType.Combined, 2 + } + }; + } + } + + protected override IDictionary ExpectedDisplayNameForEnumValues + { + get + { + return new Dictionary + { + { + SerializableFailureMechanismSectionType.FailureMechanism, "TOETSSSTE" + }, + { + SerializableFailureMechanismSectionType.Combined, "GECBNETSSTE" + } + }; + } + } + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableAssemblyTest.cs =================================================================== diff -u -re3a5124feafd13597c7bef84041df0c45d33a1e5 -rfb23c7e9b2fde4f4439e758e56ae5ed957385a71 --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableAssemblyTest.cs (.../SerializableAssemblyTest.cs) (revision e3a5124feafd13597c7bef84041df0c45d33a1e5) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableAssemblyTest.cs (.../SerializableAssemblyTest.cs) (revision fb23c7e9b2fde4f4439e758e56ae5ed957385a71) @@ -456,7 +456,8 @@ { new Point2D(0.23, 0.24), new Point2D(10.23, 10.24) - }); + }, + SerializableFailureMechanismSectionType.FailureMechanism); var result = new SerializableFailureMechanismSectionAssembly("resultaat_GABI_1", failureMechanism, @@ -478,6 +479,7 @@ new Point2D(0.23, 0.24), new Point2D(10.23, 10.24) }, + SerializableFailureMechanismSectionType.Combined, SerializableAssemblyMethod.WBI3B1); var combinedResult = new SerializableCombinedFailureMechanismSectionAssembly("resultaat_gecombineerd_1", totalAssemblyResult, Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableCombinedFailureMechanismSectionAssemblyTest.cs =================================================================== diff -u -re17ab48b3abda85cd6d9cb33e6a9f507e70fdff3 -rfb23c7e9b2fde4f4439e758e56ae5ed957385a71 --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableCombinedFailureMechanismSectionAssemblyTest.cs (.../SerializableCombinedFailureMechanismSectionAssemblyTest.cs) (revision e17ab48b3abda85cd6d9cb33e6a9f507e70fdff3) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableCombinedFailureMechanismSectionAssemblyTest.cs (.../SerializableCombinedFailureMechanismSectionAssemblyTest.cs) (revision fb23c7e9b2fde4f4439e758e56ae5ed957385a71) @@ -24,6 +24,7 @@ using NUnit.Framework; using Ringtoets.AssemblyTool.IO.Model; using Ringtoets.AssemblyTool.IO.Model.DataTypes; +using Ringtoets.AssemblyTool.IO.Model.Enums; using Ringtoets.AssemblyTool.IO.TestUtil; namespace Ringtoets.AssemblyTool.IO.Test.Model @@ -154,7 +155,8 @@ new[] { new Point2D(random.NextDouble(), random.NextDouble()) - }); + }, + SerializableFailureMechanismSectionType.Combined); var sectionResults = new SerializableCombinedFailureMechanismSectionAssemblyResult[0]; var combinedSectionResult = new SerializableFailureMechanismSectionAssemblyResult(); Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableFailureMechanismSectionAssemblyTest.cs =================================================================== diff -u -re17ab48b3abda85cd6d9cb33e6a9f507e70fdff3 -rfb23c7e9b2fde4f4439e758e56ae5ed957385a71 --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableFailureMechanismSectionAssemblyTest.cs (.../SerializableFailureMechanismSectionAssemblyTest.cs) (revision e17ab48b3abda85cd6d9cb33e6a9f507e70fdff3) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableFailureMechanismSectionAssemblyTest.cs (.../SerializableFailureMechanismSectionAssemblyTest.cs) (revision fb23c7e9b2fde4f4439e758e56ae5ed957385a71) @@ -156,7 +156,8 @@ new[] { new Point2D(random.NextDouble(), random.NextDouble()) - }); + }, + SerializableFailureMechanismSectionType.FailureMechanism); var sectionResults = new SerializableFailureMechanismSectionAssemblyResult[0]; var combinedSectionResult = new SerializableFailureMechanismSectionAssemblyResult(); Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableFailureMechanismSectionTest.cs =================================================================== diff -u -re17ab48b3abda85cd6d9cb33e6a9f507e70fdff3 -rfb23c7e9b2fde4f4439e758e56ae5ed957385a71 --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableFailureMechanismSectionTest.cs (.../SerializableFailureMechanismSectionTest.cs) (revision e17ab48b3abda85cd6d9cb33e6a9f507e70fdff3) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableFailureMechanismSectionTest.cs (.../SerializableFailureMechanismSectionTest.cs) (revision fb23c7e9b2fde4f4439e758e56ae5ed957385a71) @@ -47,7 +47,7 @@ Assert.IsNull(section.StartDistance); Assert.IsNull(section.EndDistance); Assert.IsNull(section.Geometry); - Assert.AreEqual("TOETSSSTE", section.FailureMechanismSectionType); + Assert.AreEqual((SerializableFailureMechanismSectionType) 0, section.FailureMechanismSectionType); SerializableAttributeTestHelper.AssertXmlTypeAttribute(typeof(SerializableFailureMechanismSection), "Waterkeringsectie"); @@ -81,7 +81,8 @@ new SerializableFailureMechanismSectionCollection(), random.NextDouble(), random.NextDouble(), - Enumerable.Empty()); + Enumerable.Empty(), + random.NextEnumValue()); // Assert var exception = Assert.Throws(call); @@ -99,7 +100,8 @@ null, random.NextDouble(), random.NextDouble(), - Enumerable.Empty()); + Enumerable.Empty(), + random.NextEnumValue()); // Assert var exception = Assert.Throws(call); @@ -117,7 +119,8 @@ new SerializableFailureMechanismSectionCollection(), random.NextDouble(), random.NextDouble(), - null); + null, + random.NextEnumValue()); // Assert var exception = Assert.Throws(call); @@ -135,6 +138,7 @@ double startDistance = random.NextDouble(); double endDistance = random.NextDouble(); var assemblyMethod = random.NextEnumValue(); + var sectionType = random.NextEnumValue(); var geometry = new[] { new Point2D(random.NextDouble(), random.NextDouble()), @@ -147,6 +151,7 @@ startDistance, endDistance, geometry, + sectionType, assemblyMethod); // Assert @@ -159,8 +164,8 @@ Assert.AreEqual(GeometrySerializationFormatter.Format(geometry), section.Geometry.LineString.Geometry); Assert.AreEqual("m", section.Length.UnitOfMeasure); Assert.AreEqual(Math2D.Length(geometry), section.Length.Value); - Assert.AreEqual("TOETSSSTE", section.FailureMechanismSectionType); Assert.AreEqual(assemblyMethod, section.AssemblyMethod); + Assert.AreEqual(sectionType, section.FailureMechanismSectionType); } [Test] @@ -178,6 +183,7 @@ { new Point2D(random.NextDouble(), random.NextDouble()) }, + random.NextEnumValue(), assemblyMethod); // Call Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Ringtoets.AssemblyTool.IO.Test.csproj =================================================================== diff -u -re17ab48b3abda85cd6d9cb33e6a9f507e70fdff3 -rfb23c7e9b2fde4f4439e758e56ae5ed957385a71 --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Ringtoets.AssemblyTool.IO.Test.csproj (.../Ringtoets.AssemblyTool.IO.Test.csproj) (revision e17ab48b3abda85cd6d9cb33e6a9f507e70fdff3) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Ringtoets.AssemblyTool.IO.Test.csproj (.../Ringtoets.AssemblyTool.IO.Test.csproj) (revision fb23c7e9b2fde4f4439e758e56ae5ed957385a71) @@ -22,6 +22,7 @@ +