Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/AssemblyXmlIdentifiers.cs =================================================================== diff -u -r7e15e5a8f543e9951e8a4ce5706dc32e073b1cdf -r5e2248b589fcb4b39e7ff664cd11a200b08daa28 --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/AssemblyXmlIdentifiers.cs (.../AssemblyXmlIdentifiers.cs) (revision 7e15e5a8f543e9951e8a4ce5706dc32e073b1cdf) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/AssemblyXmlIdentifiers.cs (.../AssemblyXmlIdentifiers.cs) (revision 5e2248b589fcb4b39e7ff664cd11a200b08daa28) @@ -113,19 +113,34 @@ public const string BoundedBy = "boundedBy"; /// + /// Identifier for a combined failure mechanism section assembly element. + /// + public const string CombinedFailureMechanismSectionAssembly = "GecombineerdToetsoordeel"; + + /// + /// Identifier for a combined failure mechanism section assembly ID attribute. + /// + public const string CombinedFailureMechanismSectionAssemblyId = "GecombineerdToetsoordeelID"; + + /// /// Identifier for a combined section result element. /// + public const string CombinedCombinedSectionResult = "toetsoordeelGecombineerd"; + + /// + /// Identifier for a combined section result element. + /// public const string CombinedSectionResult = "eindtoetsoordeel"; /// - /// Identifier for a coordinate system type attribute. + /// Identifier for a combined section failure mechanism result element. /// - public const string CoordinateSystem = "srsName"; + public const string CombinedSectionFailureMechanismResult = "eindtoetsoordeelToetsspoor"; /// - /// Identifier for a description element. + /// Identifier for a coordinate system type attribute. /// - public const string Description = "omschrijving"; + public const string CoordinateSystem = "srsName"; /// /// Identifier for a direct failure mechanism element. @@ -180,12 +195,12 @@ /// /// Identifier for a failure mechanism section assembly element. /// - public const string FailureMechanismSectionAssemblyResult = "Toets"; + public const string FailureMechanismSectionAssembly = "Toets"; /// /// Identifier for a failure mechanism section assembly element. /// - public const string FailureMechanismSectionAssemblyResultId = "ToetsID"; + public const string FailureMechanismSectionAssemblyId = "ToetsID"; /// /// Identifier for a failure mechanism section category group element. Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/DataTypes/SerializableCombinedFailureMechanismSectionAssemblyResult.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/DataTypes/SerializableCombinedFailureMechanismSectionAssemblyResult.cs (revision 0) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/DataTypes/SerializableCombinedFailureMechanismSectionAssemblyResult.cs (revision 5e2248b589fcb4b39e7ff664cd11a200b08daa28) @@ -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.Xml.Serialization; +using Ringtoets.AssemblyTool.IO.Model.Enums; +using Ringtoets.AssemblyTool.IO.Properties; + +namespace Ringtoets.AssemblyTool.IO.Model.DataTypes +{ + /// + /// Class describing a serializable combined failure mechanism section assembly result. + /// + public class SerializableCombinedFailureMechanismSectionAssemblyResult + { + /// + /// Creates a new instance of . + /// + public SerializableCombinedFailureMechanismSectionAssemblyResult() + { + Status = Resources.FullAssembly; + } + + /// + /// Creates a new instance of . + /// + /// The method used to assemble this result. + /// The failure mechanism type this result is assembled for. + /// The category group of this assembly result. + public SerializableCombinedFailureMechanismSectionAssemblyResult(SerializableAssemblyMethod assemblyMethod, + SerializableFailureMechanismType failureMechanismType, + SerializableFailureMechanismSectionCategoryGroup categoryGroup) : this() + { + CategoryGroup = categoryGroup; + AssemblyMethod = assemblyMethod; + FailureMechanismType = failureMechanismType; + } + + /// + /// Gets or sets the name of the method used to assemble this result. + /// + [XmlElement(AssemblyXmlIdentifiers.AssemblyMethod)] + public SerializableAssemblyMethod AssemblyMethod { get; set; } + + /// + /// Gets or sets the category group of this assembly result. + /// + [XmlElement(AssemblyXmlIdentifiers.FailureMechanismSectionCategoryGroup)] + public SerializableFailureMechanismSectionCategoryGroup CategoryGroup { get; set; } + + /// + /// Gets or sets the status of this assembly result. + /// + [XmlElement(AssemblyXmlIdentifiers.Status)] + public string Status { get; set; } + + /// + /// Gets or sets the failure mechanism type of this assembly result. + /// + [XmlElement(AssemblyXmlIdentifiers.FailureMechanismType)] + public SerializableFailureMechanismType FailureMechanismType { get; set; } + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/Enums/AssemblyXmlEnumIdentifiers.cs =================================================================== diff -u -rb53d4c3c4221c2fcbc7b3c679e62d59a165fe8d4 -r5e2248b589fcb4b39e7ff664cd11a200b08daa28 --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/Enums/AssemblyXmlEnumIdentifiers.cs (.../AssemblyXmlEnumIdentifiers.cs) (revision b53d4c3c4221c2fcbc7b3c679e62d59a165fe8d4) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/Enums/AssemblyXmlEnumIdentifiers.cs (.../AssemblyXmlEnumIdentifiers.cs) (revision 5e2248b589fcb4b39e7ff664cd11a200b08daa28) @@ -398,11 +398,6 @@ /// public const string SerializableAssessmentLevelCombinedSectionAssessment = "GECBNTRDV"; - /// - /// Identifier for . - /// - public const string SerializableAssessmentLevelCombinedSectionFailureMechanismAssessment = "GECBNTRDVTS"; - #endregion } } \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/Enums/SerializableAssessmentLevel.cs =================================================================== diff -u -rd25cb785f385ccf9a25b57aeeaf741a2c78ef356 -r5e2248b589fcb4b39e7ff664cd11a200b08daa28 --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/Enums/SerializableAssessmentLevel.cs (.../SerializableAssessmentLevel.cs) (revision d25cb785f385ccf9a25b57aeeaf741a2c78ef356) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/Enums/SerializableAssessmentLevel.cs (.../SerializableAssessmentLevel.cs) (revision 5e2248b589fcb4b39e7ff664cd11a200b08daa28) @@ -56,12 +56,6 @@ /// Represents the cmbined section assessment level. /// [XmlEnum(AssemblyXmlEnumIdentifiers.SerializableAssessmentLevelCombinedSectionAssessment)] - CombinedSectionAssessment = 5, - - /// - /// Represents the combined section per failure mechanism assessment level. - /// - [XmlEnum(AssemblyXmlEnumIdentifiers.SerializableAssessmentLevelCombinedSectionFailureMechanismAssessment)] - CombinedSectionFailureMechanismAssessment = 6 + CombinedSectionAssessment = 5 } } \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableAssembly.cs =================================================================== diff -u -r5c59e60cae7bc68b321c0ee187a7d4dd9dd753b2 -r5e2248b589fcb4b39e7ff664cd11a200b08daa28 --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableAssembly.cs (.../SerializableAssembly.cs) (revision 5c59e60cae7bc68b321c0ee187a7d4dd9dd753b2) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableAssembly.cs (.../SerializableAssembly.cs) (revision 5e2248b589fcb4b39e7ff664cd11a200b08daa28) @@ -97,6 +97,7 @@ [XmlArrayItem(typeof(SerializableFailureMechanismSectionAssembly))] [XmlArrayItem(typeof(SerializableFailureMechanismSections))] [XmlArrayItem(typeof(SerializableFailureMechanismSection))] + [XmlArrayItem(typeof(SerializableCombinedFailureMechanismSectionAssembly))] public SerializableFeatureMember[] FeatureMembers { get; set; } } } \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableCombinedFailureMechanismSectionAssembly.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableCombinedFailureMechanismSectionAssembly.cs (revision 0) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableCombinedFailureMechanismSectionAssembly.cs (revision 5e2248b589fcb4b39e7ff664cd11a200b08daa28) @@ -0,0 +1,116 @@ +// 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.Xml.Serialization; +using Ringtoets.AssemblyTool.IO.Model.DataTypes; + +namespace Ringtoets.AssemblyTool.IO.Model +{ + /// + /// Class describing a serializable combined failure mechanism section assembly. + /// + [XmlType(AssemblyXmlIdentifiers.CombinedFailureMechanismSectionAssembly)] + public class SerializableCombinedFailureMechanismSectionAssembly : SerializableFeatureMember + { + /// + /// Creates a new instance of . + /// + public SerializableCombinedFailureMechanismSectionAssembly() {} + + /// + /// Creates a new instance of . + /// + /// The unique ID of the assembly. + /// The total assembly result this assembly belongs to. + /// The section this assembly belongs to. + /// The collection of assembly results for this assembly per failure mechanism. + /// The combined assembly result for this assembly. + /// Thrown when any parameter is null. + public SerializableCombinedFailureMechanismSectionAssembly(string id, + SerializableTotalAssemblyResult totalAssemblyResult, + SerializableFailureMechanismSection section, + SerializableCombinedFailureMechanismSectionAssemblyResult[] failureMechanismResults, + SerializableFailureMechanismSectionAssemblyResult combinedSectionResult) : this() + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + if (totalAssemblyResult == null) + { + throw new ArgumentNullException(nameof(totalAssemblyResult)); + } + + if (section == null) + { + throw new ArgumentNullException(nameof(section)); + } + + if (failureMechanismResults == null) + { + throw new ArgumentNullException(nameof(failureMechanismResults)); + } + + if (combinedSectionResult == null) + { + throw new ArgumentNullException(nameof(combinedSectionResult)); + } + + Id = id; + TotalAssemblyResultId = totalAssemblyResult.Id; + FailureMechanismSectionId = section.Id; + FailureMechanismResults = failureMechanismResults; + CombinedSectionResult = combinedSectionResult; + } + + /// + /// Gets or sets the ID. + /// + [XmlAttribute(AssemblyXmlIdentifiers.CombinedFailureMechanismSectionAssemblyId)] + public string Id { get; set; } + + /// + /// Gets or sets the parent total assembly result ID. + /// + [XmlAttribute(AssemblyXmlIdentifiers.TotalAssemblyResultIdRef)] + public string TotalAssemblyResultId { get; set; } + + /// + /// Gets or sets the parent failure mechanism section ID. + /// + [XmlAttribute(AssemblyXmlIdentifiers.FailureMechanismSectionIdRef)] + public string FailureMechanismSectionId { get; set; } + + /// + /// Gets or sets the combined assembly result. + /// + [XmlElement(AssemblyXmlIdentifiers.CombinedCombinedSectionResult)] + public SerializableFailureMechanismSectionAssemblyResult CombinedSectionResult { get; set; } + + /// + /// Gets or sets the array of results for this section per failure mechanism. + /// + [XmlElement(AssemblyXmlIdentifiers.CombinedSectionFailureMechanismResult)] + public SerializableCombinedFailureMechanismSectionAssemblyResult[] FailureMechanismResults { get; set; } + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableFailureMechanismSectionAssembly.cs =================================================================== diff -u -r24154e2ef651d5deac25c6caf8f143d0348b29ff -r5e2248b589fcb4b39e7ff664cd11a200b08daa28 --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableFailureMechanismSectionAssembly.cs (.../SerializableFailureMechanismSectionAssembly.cs) (revision 24154e2ef651d5deac25c6caf8f143d0348b29ff) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableFailureMechanismSectionAssembly.cs (.../SerializableFailureMechanismSectionAssembly.cs) (revision 5e2248b589fcb4b39e7ff664cd11a200b08daa28) @@ -26,9 +26,9 @@ namespace Ringtoets.AssemblyTool.IO.Model { /// - /// Class describing a serializable failure mechanism section assembly result. + /// Class describing a serializable failure mechanism section assembly. /// - [XmlType(AssemblyXmlIdentifiers.FailureMechanismSectionAssemblyResult)] + [XmlType(AssemblyXmlIdentifiers.FailureMechanismSectionAssembly)] public class SerializableFailureMechanismSectionAssembly : SerializableFeatureMember { /// @@ -39,7 +39,7 @@ /// /// Creates a new instance of . /// - /// The unique ID of the assembly result. + /// The unique ID of the assembly. /// The failure mechanism this assembly belongs to. /// The section this assembly belongs to. /// The collection of assembly results for this section assembly. @@ -86,7 +86,7 @@ /// /// Gets or sets the ID. /// - [XmlAttribute(AssemblyXmlIdentifiers.FailureMechanismSectionAssemblyResultId)] + [XmlAttribute(AssemblyXmlIdentifiers.FailureMechanismSectionAssemblyId)] public string Id { get; set; } /// Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Ringtoets.AssemblyTool.IO.csproj =================================================================== diff -u -r908ef4dfa4bb09ceacb29d33bdfe5680b6e50372 -r5e2248b589fcb4b39e7ff664cd11a200b08daa28 --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Ringtoets.AssemblyTool.IO.csproj (.../Ringtoets.AssemblyTool.IO.csproj) (revision 908ef4dfa4bb09ceacb29d33bdfe5680b6e50372) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Ringtoets.AssemblyTool.IO.csproj (.../Ringtoets.AssemblyTool.IO.csproj) (revision 5e2248b589fcb4b39e7ff664cd11a200b08daa28) @@ -19,6 +19,7 @@ + @@ -32,6 +33,7 @@ + Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/DataTypes/SerializableCombinedFailureMechanismSectionAssemblyResultTest.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/DataTypes/SerializableCombinedFailureMechanismSectionAssemblyResultTest.cs (revision 0) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/DataTypes/SerializableCombinedFailureMechanismSectionAssemblyResultTest.cs (revision 5e2248b589fcb4b39e7ff664cd11a200b08daa28) @@ -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 Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.AssemblyTool.IO.Model.DataTypes; +using Ringtoets.AssemblyTool.IO.Model.Enums; +using Ringtoets.AssemblyTool.IO.TestUtil; + +namespace Ringtoets.AssemblyTool.IO.Test.Model.DataTypes +{ + [TestFixture] + public class SerializableCombinedFailureMechanismSectionAssemblyResultTest + { + [Test] + public void DefaultConstructor_ReturnsDefaultValues() + { + // Call + var assemblyResult = new SerializableCombinedFailureMechanismSectionAssemblyResult(); + + // Assert + Assert.AreEqual((SerializableAssemblyMethod) 0, assemblyResult.AssemblyMethod); + Assert.AreEqual((SerializableFailureMechanismType) 0, assemblyResult.FailureMechanismType); + Assert.AreEqual((SerializableFailureMechanismSectionCategoryGroup) 0, assemblyResult.CategoryGroup); + Assert.AreEqual("VOLLDG", assemblyResult.Status); + + SerializableAttributeTestHelper.AssertXmlElementAttribute( + nameof(SerializableCombinedFailureMechanismSectionAssemblyResult.AssemblyMethod), "assemblagemethode"); + SerializableAttributeTestHelper.AssertXmlElementAttribute( + nameof(SerializableCombinedFailureMechanismSectionAssemblyResult.CategoryGroup), "categorieVak"); + SerializableAttributeTestHelper.AssertXmlElementAttribute( + nameof(SerializableCombinedFailureMechanismSectionAssemblyResult.FailureMechanismType), "typeToetsspoor"); + SerializableAttributeTestHelper.AssertXmlElementAttribute( + nameof(SerializableCombinedFailureMechanismSectionAssemblyResult.Status), "status"); + } + + [Test] + public void Constructor_WithValidData_ReturnsExpectedValues() + { + // Setup + var random = new Random(39); + var category = random.NextEnumValue(); + var failureMechanismType = random.NextEnumValue(); + var assemblyMethod = random.NextEnumValue(); + + // Call + var assemblyResult = new SerializableCombinedFailureMechanismSectionAssemblyResult(assemblyMethod, failureMechanismType, category); + + // Assert + Assert.AreEqual(assemblyMethod, assemblyResult.AssemblyMethod); + Assert.AreEqual(category, assemblyResult.CategoryGroup); + Assert.AreEqual(failureMechanismType, assemblyResult.FailureMechanismType); + Assert.AreEqual("VOLLDG", assemblyResult.Status); + } + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/Enums/AssemblyXmlEnumIdentifiersTest.cs =================================================================== diff -u -rb53d4c3c4221c2fcbc7b3c679e62d59a165fe8d4 -r5e2248b589fcb4b39e7ff664cd11a200b08daa28 --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/Enums/AssemblyXmlEnumIdentifiersTest.cs (.../AssemblyXmlEnumIdentifiersTest.cs) (revision b53d4c3c4221c2fcbc7b3c679e62d59a165fe8d4) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/Enums/AssemblyXmlEnumIdentifiersTest.cs (.../AssemblyXmlEnumIdentifiersTest.cs) (revision 5e2248b589fcb4b39e7ff664cd11a200b08daa28) @@ -106,7 +106,6 @@ Assert.AreEqual("TOETSOPMT", AssemblyXmlEnumIdentifiers.SerializableAssessmentLevelTailorMadeAssessment); Assert.AreEqual("GECBNTR", AssemblyXmlEnumIdentifiers.SerializableAssessmentLevelCombinedAssessment); Assert.AreEqual("GECBNTRDV", AssemblyXmlEnumIdentifiers.SerializableAssessmentLevelCombinedSectionAssessment); - Assert.AreEqual("GECBNTRDVTS", AssemblyXmlEnumIdentifiers.SerializableAssessmentLevelCombinedSectionFailureMechanismAssessment); } } } \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/Enums/SerializableAssessmentLevelTest.cs =================================================================== diff -u -rd0d416e8cadb9c542bce09ab6d8ce304d651d9b8 -r5e2248b589fcb4b39e7ff664cd11a200b08daa28 --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/Enums/SerializableAssessmentLevelTest.cs (.../SerializableAssessmentLevelTest.cs) (revision d0d416e8cadb9c542bce09ab6d8ce304d651d9b8) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/Enums/SerializableAssessmentLevelTest.cs (.../SerializableAssessmentLevelTest.cs) (revision 5e2248b589fcb4b39e7ff664cd11a200b08daa28) @@ -49,9 +49,6 @@ }, { SerializableAssessmentLevel.CombinedSectionAssessment, 5 - }, - { - SerializableAssessmentLevel.CombinedSectionFailureMechanismAssessment, 6 } }; } @@ -77,9 +74,6 @@ }, { SerializableAssessmentLevel.CombinedSectionAssessment, "GECBNTRDV" - }, - { - SerializableAssessmentLevel.CombinedSectionFailureMechanismAssessment, "GECBNTRDVTS" } }; } Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableAssemblyTest.cs =================================================================== diff -u -r48a70fa6c4d7f5a73e2b2d10fe074f2ec7321a82 -r5e2248b589fcb4b39e7ff664cd11a200b08daa28 --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableAssemblyTest.cs (.../SerializableAssemblyTest.cs) (revision 48a70fa6c4d7f5a73e2b2d10fe074f2ec7321a82) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableAssemblyTest.cs (.../SerializableAssemblyTest.cs) (revision 5e2248b589fcb4b39e7ff664cd11a200b08daa28) @@ -66,14 +66,15 @@ Assert.AreEqual("featureMember", xmlArrayAttribute.ElementName); IEnumerable xmlArrayItemAttributes = TypeUtils.GetPropertyAttributes(nameof(SerializableAssembly.FeatureMembers)); - Assert.AreEqual(7, xmlArrayItemAttributes.Count()); + Assert.AreEqual(8, xmlArrayItemAttributes.Count()); Assert.AreEqual(typeof(SerializableAssessmentProcess), xmlArrayItemAttributes.ElementAt(0).Type); Assert.AreEqual(typeof(SerializableAssessmentSection), xmlArrayItemAttributes.ElementAt(1).Type); Assert.AreEqual(typeof(SerializableTotalAssemblyResult), xmlArrayItemAttributes.ElementAt(2).Type); Assert.AreEqual(typeof(SerializableFailureMechanism), xmlArrayItemAttributes.ElementAt(3).Type); Assert.AreEqual(typeof(SerializableFailureMechanismSectionAssembly), xmlArrayItemAttributes.ElementAt(4).Type); Assert.AreEqual(typeof(SerializableFailureMechanismSections), xmlArrayItemAttributes.ElementAt(5).Type); Assert.AreEqual(typeof(SerializableFailureMechanismSection), xmlArrayItemAttributes.ElementAt(6).Type); + Assert.AreEqual(typeof(SerializableCombinedFailureMechanismSectionAssembly), xmlArrayItemAttributes.ElementAt(7).Type); } [Test] @@ -196,26 +197,26 @@ }) }; - var assessmentProcess = new SerializableAssessmentProcess("process1", + var assessmentProcess = new SerializableAssessmentProcess("beoordelingsproces1", assessmentSection, 2018, 2020); var totalAssemblyResult = new SerializableTotalAssemblyResult( - "total id", + "veiligheidsoordeel_1", assessmentProcess, new SerializableFailureMechanismAssemblyResult(SerializableAssemblyMethod.WBI2B1, SerializableFailureMechanismCategoryGroup.IIt), new SerializableFailureMechanismAssemblyResult(SerializableAssemblyMethod.WBI3C1, SerializableFailureMechanismCategoryGroup.NotApplicable, 0.000124), new SerializableAssessmentSectionAssemblyResult(SerializableAssemblyMethod.WBI2C1, SerializableAssessmentSectionCategoryGroup.B)); - var failureMechanism1 = new SerializableFailureMechanism("fm1", + var failureMechanism1 = new SerializableFailureMechanism("toetsspoorGABI", totalAssemblyResult, SerializableFailureMechanismType.GABI, SerializableAssemblyGroup.Group4, new SerializableFailureMechanismAssemblyResult(SerializableAssemblyMethod.WBI1A1, SerializableFailureMechanismCategoryGroup.IIt)); - var sections1 = new SerializableFailureMechanismSections("sections1", failureMechanism1); - var section1 = new SerializableFailureMechanismSection("s1", + var sections1 = new SerializableFailureMechanismSections("vakindelingGABI", failureMechanism1); + var section1 = new SerializableFailureMechanismSection("vak_GABI_1", sections1, 0.12, 10.23, @@ -226,7 +227,7 @@ }, SerializableAssemblyMethod.WBI3B1); - var result1 = new SerializableFailureMechanismSectionAssembly("sr1", + var result1 = new SerializableFailureMechanismSectionAssembly("resultaat_GABI_1", failureMechanism1, section1, new[] @@ -236,7 +237,28 @@ }, new SerializableFailureMechanismSectionAssemblyResult(SerializableAssemblyMethod.WBI0A1, SerializableAssessmentLevel.CombinedAssessment, SerializableFailureMechanismSectionCategoryGroup.IIIv)); - var assembly = new SerializableAssembly("assembly_1", new Point2D(12.0, 34.0), new Point2D(56.053, 78.0002345), + var sections2 = new SerializableFailureMechanismSections("vakindeling_gecombineerd", failureMechanism1); + var section2 = new SerializableFailureMechanismSection("vak_gecombineerd_1", + sections2, + 0.12, + 10.23, + new[] + { + new Point2D(0.23, 0.24), + new Point2D(10.23, 10.24) + }, + SerializableAssemblyMethod.WBI3B1); + var combinedResult = new SerializableCombinedFailureMechanismSectionAssembly("resultaat_gecombineerd_1", + totalAssemblyResult, + section2, + new[] + { + new SerializableCombinedFailureMechanismSectionAssemblyResult(SerializableAssemblyMethod.WBI3C1, SerializableFailureMechanismType.HTKW, SerializableFailureMechanismSectionCategoryGroup.IIIv), + new SerializableCombinedFailureMechanismSectionAssemblyResult(SerializableAssemblyMethod.WBI3C1, SerializableFailureMechanismType.STPH, SerializableFailureMechanismSectionCategoryGroup.IVv), + }, + new SerializableFailureMechanismSectionAssemblyResult(SerializableAssemblyMethod.WBI3B1, SerializableAssessmentLevel.CombinedSectionAssessment, SerializableFailureMechanismSectionCategoryGroup.VIv)); + + var assembly = new SerializableAssembly("assemblage_1", new Point2D(12.0, 34.0), new Point2D(56.053, 78.0002345), new SerializableFeatureMember[] { assessmentSection, @@ -245,7 +267,10 @@ failureMechanism1, result1, sections1, - section1 + section1, + sections2, + section2, + combinedResult }); serializer.Serialize(writer, assembly, xmlns); Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableCombinedFailureMechanismSectionAssemblyTest.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableCombinedFailureMechanismSectionAssemblyTest.cs (revision 0) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableCombinedFailureMechanismSectionAssemblyTest.cs (revision 5e2248b589fcb4b39e7ff664cd11a200b08daa28) @@ -0,0 +1,174 @@ +// 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.Base.Geometry; +using NUnit.Framework; +using Ringtoets.AssemblyTool.IO.Model; +using Ringtoets.AssemblyTool.IO.Model.DataTypes; +using Ringtoets.AssemblyTool.IO.TestUtil; + +namespace Ringtoets.AssemblyTool.IO.Test.Model +{ + [TestFixture] + public class SerializableCombinedFailureMechanismSectionAssemblyTest + { + [Test] + public void DefaultConstructor_ReturnsDefaultValues() + { + // Call + var combinedSectionAssembly = new SerializableCombinedFailureMechanismSectionAssembly(); + + // Assert + Assert.IsInstanceOf(combinedSectionAssembly); + Assert.IsNull(combinedSectionAssembly.Id); + Assert.IsNull(combinedSectionAssembly.TotalAssemblyResultId); + Assert.IsNull(combinedSectionAssembly.FailureMechanismSectionId); + Assert.IsNull(combinedSectionAssembly.CombinedSectionResult); + Assert.IsNull(combinedSectionAssembly.FailureMechanismResults); + + SerializableAttributeTestHelper.AssertXmlAttributeAttribute( + nameof(SerializableCombinedFailureMechanismSectionAssembly.Id), "GecombineerdToetsoordeelID"); + SerializableAttributeTestHelper.AssertXmlAttributeAttribute( + nameof(SerializableCombinedFailureMechanismSectionAssembly.TotalAssemblyResultId), "VeiligheidsoordeelIDRef"); + SerializableAttributeTestHelper.AssertXmlAttributeAttribute( + nameof(SerializableCombinedFailureMechanismSectionAssembly.FailureMechanismSectionId), "WaterkeringsectieIDRef"); + + SerializableAttributeTestHelper.AssertXmlElementAttribute( + nameof(SerializableCombinedFailureMechanismSectionAssembly.CombinedSectionResult), "toetsoordeelGecombineerd"); + SerializableAttributeTestHelper.AssertXmlElementAttribute( + nameof(SerializableCombinedFailureMechanismSectionAssembly.FailureMechanismResults), "eindtoetsoordeelToetsspoor"); + } + + [Test] + public void Constructor_IdNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new SerializableCombinedFailureMechanismSectionAssembly(null, + new SerializableTotalAssemblyResult(), + new SerializableFailureMechanismSection(), + new SerializableCombinedFailureMechanismSectionAssemblyResult[0], + new SerializableFailureMechanismSectionAssemblyResult()); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("id", exception.ParamName); + } + + [Test] + public void Constructor_TotalAssemblyResultNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new SerializableCombinedFailureMechanismSectionAssembly("id", + null, + new SerializableFailureMechanismSection(), + new SerializableCombinedFailureMechanismSectionAssemblyResult[0], + new SerializableFailureMechanismSectionAssemblyResult()); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("totalAssemblyResult", exception.ParamName); + } + + [Test] + public void Constructor_SectionNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new SerializableCombinedFailureMechanismSectionAssembly("id", + new SerializableTotalAssemblyResult(), + null, + new SerializableCombinedFailureMechanismSectionAssemblyResult[0], + new SerializableFailureMechanismSectionAssemblyResult()); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("section", exception.ParamName); + } + + [Test] + public void Constructor_FailureMechanismResultsNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new SerializableCombinedFailureMechanismSectionAssembly("id", + new SerializableTotalAssemblyResult(), + new SerializableFailureMechanismSection(), + null, + new SerializableFailureMechanismSectionAssemblyResult()); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("failureMechanismResults", exception.ParamName); + } + + [Test] + public void Constructor_CombinedSectionResultNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new SerializableCombinedFailureMechanismSectionAssembly("id", + new SerializableTotalAssemblyResult(), + new SerializableFailureMechanismSection(), + new SerializableCombinedFailureMechanismSectionAssemblyResult[0], + null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("combinedSectionResult", exception.ParamName); + } + + [Test] + public void Constructor_WithValidData_ReturnsExpectedValues() + { + // Setup + const string id = "id"; + + var random = new Random(39); + var totalAssembly = new SerializableTotalAssemblyResult("total assembly ID", + new SerializableAssessmentProcess(), + new SerializableFailureMechanismAssemblyResult(), + new SerializableFailureMechanismAssemblyResult(), + new SerializableAssessmentSectionAssemblyResult()); + var section = new SerializableFailureMechanismSection("section ID", + new SerializableFailureMechanismSections(), + random.NextDouble(), + random.NextDouble(), + new[] + { + new Point2D(random.NextDouble(), random.NextDouble()) + }); + var sectionResults = new SerializableCombinedFailureMechanismSectionAssemblyResult[0]; + var combinedSectionResult = new SerializableFailureMechanismSectionAssemblyResult(); + + // Call + var combinedSectionAssembly = new SerializableCombinedFailureMechanismSectionAssembly(id, + totalAssembly, + section, + sectionResults, + combinedSectionResult); + + // Assert + Assert.AreEqual(id, combinedSectionAssembly.Id); + Assert.AreEqual(totalAssembly.Id, combinedSectionAssembly.TotalAssemblyResultId); + Assert.AreEqual(section.Id, combinedSectionAssembly.FailureMechanismSectionId); + Assert.AreSame(sectionResults, combinedSectionAssembly.FailureMechanismResults); + Assert.AreSame(combinedSectionResult, combinedSectionAssembly.CombinedSectionResult); + } + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Ringtoets.AssemblyTool.IO.Test.csproj =================================================================== diff -u -r908ef4dfa4bb09ceacb29d33bdfe5680b6e50372 -r5e2248b589fcb4b39e7ff664cd11a200b08daa28 --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Ringtoets.AssemblyTool.IO.Test.csproj (.../Ringtoets.AssemblyTool.IO.Test.csproj) (revision 908ef4dfa4bb09ceacb29d33bdfe5680b6e50372) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Ringtoets.AssemblyTool.IO.Test.csproj (.../Ringtoets.AssemblyTool.IO.Test.csproj) (revision 5e2248b589fcb4b39e7ff664cd11a200b08daa28) @@ -16,6 +16,7 @@ + @@ -27,6 +28,7 @@ +