Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/AssemblyXmlIdentifiers.cs =================================================================== diff -u -r9ad4c9daea5f2a20f2cc61df9ea79d1144d84b2e -r2a28064a44daa277c25e597f4b3eea1edd52e37c --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/AssemblyXmlIdentifiers.cs (.../AssemblyXmlIdentifiers.cs) (revision 9ad4c9daea5f2a20f2cc61df9ea79d1144d84b2e) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/AssemblyXmlIdentifiers.cs (.../AssemblyXmlIdentifiers.cs) (revision 2a28064a44daa277c25e597f4b3eea1edd52e37c) @@ -218,14 +218,14 @@ public const string FailureMechanismSections = "Vakindeling"; /// - /// Identifier for a failure mechanism sections ID attribute. + /// Identifier for a failure mechanism section collection ID attribute. /// - public const string FailureMechanismSectionsId = "VakindelingID"; + public const string FailureMechanismSectionCollectionId = "VakindelingID"; /// - /// Identifier for a failure mechanism sections ID reference attribute. + /// Identifier for a failure mechanism section collection ID reference attribute. /// - public const string FailureMechanismSectionsIdRef = "VakindelingIDRef"; + public const string FailureMechanismSectionCollectionIdRef = "VakindelingIDRef"; /// /// Identifier for a failure mechanism section type element. Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableAssembly.cs =================================================================== diff -u -r5e2248b589fcb4b39e7ff664cd11a200b08daa28 -r2a28064a44daa277c25e597f4b3eea1edd52e37c --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableAssembly.cs (.../SerializableAssembly.cs) (revision 5e2248b589fcb4b39e7ff664cd11a200b08daa28) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableAssembly.cs (.../SerializableAssembly.cs) (revision 2a28064a44daa277c25e597f4b3eea1edd52e37c) @@ -20,6 +20,8 @@ // All rights reserved. using System; +using System.Collections.Generic; +using System.Linq; using System.Xml.Serialization; using Core.Common.Base.Geometry; using Ringtoets.AssemblyTool.IO.Model.Gml; @@ -44,10 +46,34 @@ /// The unique ID of the assembly. /// The lower corner of the assembly map boundary. /// The upper corner of the assembly map boundary. - /// The collection of that + /// The collection of that /// belong to the assembly. + /// The collection of that + /// belong to the assembly. + /// The collection of that + /// belong to the assembly. + /// The collection of that + /// belong to the assembly. + /// The collection of that + /// belong to the assembly. + /// The collection of that + /// belong to the assembly. + /// The collection of that + /// belong to the assembly. + /// The collection of that + /// belong to the assembly. /// Thrown when any parameter is null. - public SerializableAssembly(string id, Point2D lowerCorner, Point2D upperCorner, SerializableFeatureMember[] featureMembers) + public SerializableAssembly(string id, + Point2D lowerCorner, + Point2D upperCorner, + IEnumerable assessmentSections, + IEnumerable assessmentProcesses, + IEnumerable totalAssemblyResults, + IEnumerable failureMechanisms, + IEnumerable failureMechanismSectionAssemblies, + IEnumerable combinedFailureMechanismSectionAssemblies, + IEnumerable failureMechanismSectionCollections, + IEnumerable failureMechanismSections) { if (id == null) { @@ -64,14 +90,59 @@ throw new ArgumentNullException(nameof(upperCorner)); } - if (featureMembers == null) + if (assessmentSections == null) { - throw new ArgumentNullException(nameof(featureMembers)); + throw new ArgumentNullException(nameof(assessmentSections)); } + if (assessmentProcesses == null) + { + throw new ArgumentNullException(nameof(assessmentProcesses)); + } + + if (totalAssemblyResults == null) + { + throw new ArgumentNullException(nameof(totalAssemblyResults)); + } + + if (failureMechanisms == null) + { + throw new ArgumentNullException(nameof(failureMechanisms)); + } + + if (failureMechanismSectionAssemblies == null) + { + throw new ArgumentNullException(nameof(failureMechanismSectionAssemblies)); + } + + if (combinedFailureMechanismSectionAssemblies == null) + { + throw new ArgumentNullException(nameof(combinedFailureMechanismSectionAssemblies)); + } + + if (failureMechanismSectionCollections == null) + { + throw new ArgumentNullException(nameof(failureMechanismSectionCollections)); + } + + if (failureMechanismSections == null) + { + throw new ArgumentNullException(nameof(failureMechanismSections)); + } + Id = id; Boundary = new SerializableBoundary(lowerCorner, upperCorner); - FeatureMembers = featureMembers; + + var featureMembers = new List(); + featureMembers.AddRange(assessmentSections); + featureMembers.AddRange(assessmentProcesses); + featureMembers.AddRange(totalAssemblyResults); + featureMembers.AddRange(failureMechanisms); + featureMembers.AddRange(failureMechanismSectionAssemblies); + featureMembers.AddRange(combinedFailureMechanismSectionAssemblies); + featureMembers.AddRange(failureMechanismSectionCollections); + featureMembers.AddRange(failureMechanismSections); + FeatureMembers = featureMembers.ToArray(); } /// @@ -90,14 +161,14 @@ /// Gets or sets the collection of feature members for the assembly. /// [XmlArray(AssemblyXmlIdentifiers.FeatureMember)] - [XmlArrayItem(typeof(SerializableAssessmentProcess))] [XmlArrayItem(typeof(SerializableAssessmentSection))] + [XmlArrayItem(typeof(SerializableAssessmentProcess))] [XmlArrayItem(typeof(SerializableTotalAssemblyResult))] [XmlArrayItem(typeof(SerializableFailureMechanism))] [XmlArrayItem(typeof(SerializableFailureMechanismSectionAssembly))] - [XmlArrayItem(typeof(SerializableFailureMechanismSections))] - [XmlArrayItem(typeof(SerializableFailureMechanismSection))] [XmlArrayItem(typeof(SerializableCombinedFailureMechanismSectionAssembly))] + [XmlArrayItem(typeof(SerializableFailureMechanismSectionCollection))] + [XmlArrayItem(typeof(SerializableFailureMechanismSection))] public SerializableFeatureMember[] FeatureMembers { get; set; } } } \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableFailureMechanismSection.cs =================================================================== diff -u -r1b1e58033efcfa5b93c0a2cd442e7c37d5ae91ab -r2a28064a44daa277c25e597f4b3eea1edd52e37c --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableFailureMechanismSection.cs (.../SerializableFailureMechanismSection.cs) (revision 1b1e58033efcfa5b93c0a2cd442e7c37d5ae91ab) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableFailureMechanismSection.cs (.../SerializableFailureMechanismSection.cs) (revision 2a28064a44daa277c25e597f4b3eea1edd52e37c) @@ -47,14 +47,14 @@ /// Creates a new instance of . /// /// The unique ID of the section. - /// The failure mechanism sections object the section belong to. + /// The failure mechanism sections object the section belong to. /// 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 assembly method used to create this section. /// Thrown when any parameter is null. public SerializableFailureMechanismSection(string id, - SerializableFailureMechanismSections failureMechanismSections, + SerializableFailureMechanismSectionCollection failureMechanismSectionCollection, double startDistance, double endDistance, IEnumerable geometry, @@ -65,9 +65,9 @@ throw new ArgumentNullException(nameof(id)); } - if (failureMechanismSections == null) + if (failureMechanismSectionCollection == null) { - throw new ArgumentNullException(nameof(failureMechanismSections)); + throw new ArgumentNullException(nameof(failureMechanismSectionCollection)); } if (geometry == null) @@ -78,7 +78,7 @@ Id = id; StartDistance = new SerializableMeasure("m", startDistance); EndDistance = new SerializableMeasure("m", endDistance); - FailureMechanismSectionsId = failureMechanismSections.Id; + FailureMechanismSectionCollectionId = failureMechanismSectionCollection.Id; Geometry = new SerializableLine(geometry); Length = new SerializableMeasure("m", Math2D.Length(geometry)); AssemblyMethod = assemblyMethod; @@ -91,10 +91,10 @@ public string Id { get; set; } /// - /// Gets or sets the ID of the parent failure mechanism sections. + /// Gets or sets the ID of the parent failure mechanism section collection. /// - [XmlAttribute(AssemblyXmlIdentifiers.FailureMechanismSectionsIdRef)] - public string FailureMechanismSectionsId { get; set; } + [XmlAttribute(AssemblyXmlIdentifiers.FailureMechanismSectionCollectionIdRef)] + public string FailureMechanismSectionCollectionId { get; set; } /// /// Gets or sets the section starting distance. Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableFailureMechanismSectionCollection.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableFailureMechanismSectionCollection.cs (revision 0) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableFailureMechanismSectionCollection.cs (revision 2a28064a44daa277c25e597f4b3eea1edd52e37c) @@ -0,0 +1,107 @@ +// 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; + +namespace Ringtoets.AssemblyTool.IO.Model +{ + /// + /// Class describing a serializable failure mechanism section collection object. + /// + [XmlType(AssemblyXmlIdentifiers.FailureMechanismSections)] + public class SerializableFailureMechanismSectionCollection : SerializableFeatureMember + { + /// + /// Creates a new instance of . + /// + public SerializableFailureMechanismSectionCollection() {} + + /// + /// Creates a new instance of . + /// + /// The unique ID of the sections. + /// The failure mechanism the sections belong to. + /// Thrown when any parameter is null. + public SerializableFailureMechanismSectionCollection(string id, + SerializableFailureMechanism failureMechanism) + : this(id) + { + if (failureMechanism == null) + { + throw new ArgumentNullException(nameof(failureMechanism)); + } + + FailureMechanismId = failureMechanism.Id; + } + + /// + /// Creates a new instance of . + /// + /// The unique ID of the sections. + /// The total assembly result the sections belong to. + /// Thrown when any parameter is null. + public SerializableFailureMechanismSectionCollection(string id, + SerializableTotalAssemblyResult totalAssemblyResult) + : this(id) + { + if (totalAssemblyResult == null) + { + throw new ArgumentNullException(nameof(totalAssemblyResult)); + } + + TotalAssemblyResultId = totalAssemblyResult.Id; + } + + /// + /// Creates a new instance of . + /// + /// The unique ID of the sections. + /// Thrown when is null. + private SerializableFailureMechanismSectionCollection(string id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + Id = id; + } + + /// + /// Gets or sets the ID. + /// + [XmlAttribute(AssemblyXmlIdentifiers.FailureMechanismSectionCollectionId)] + public string Id { get; set; } + + /// + /// Gets or sets the ID of the parent failure mechanism. + /// + [XmlAttribute(AssemblyXmlIdentifiers.FailureMechanismIdRef)] + public string FailureMechanismId { get; set; } + + /// + /// Gets or sets the ID of the parent total assembly result. + /// + [XmlAttribute(AssemblyXmlIdentifiers.TotalAssemblyResultIdRef)] + public string TotalAssemblyResultId { get; set; } + } +} \ No newline at end of file Fisheye: Tag 2a28064a44daa277c25e597f4b3eea1edd52e37c refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableFailureMechanismSections.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Ringtoets.AssemblyTool.IO.csproj =================================================================== diff -u -r9ad4c9daea5f2a20f2cc61df9ea79d1144d84b2e -r2a28064a44daa277c25e597f4b3eea1edd52e37c --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Ringtoets.AssemblyTool.IO.csproj (.../Ringtoets.AssemblyTool.IO.csproj) (revision 9ad4c9daea5f2a20f2cc61df9ea79d1144d84b2e) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Ringtoets.AssemblyTool.IO.csproj (.../Ringtoets.AssemblyTool.IO.csproj) (revision 2a28064a44daa277c25e597f4b3eea1edd52e37c) @@ -34,7 +34,7 @@ - + Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableAssemblyTest.cs =================================================================== diff -u -r9ad4c9daea5f2a20f2cc61df9ea79d1144d84b2e -r2a28064a44daa277c25e597f4b3eea1edd52e37c --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableAssemblyTest.cs (.../SerializableAssemblyTest.cs) (revision 9ad4c9daea5f2a20f2cc61df9ea79d1144d84b2e) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableAssemblyTest.cs (.../SerializableAssemblyTest.cs) (revision 2a28064a44daa277c25e597f4b3eea1edd52e37c) @@ -24,8 +24,6 @@ using System.Globalization; using System.IO; using System.Linq; -using System.Reflection; -using System.Text; using System.Xml.Linq; using System.Xml.Schema; using System.Xml.Serialization; @@ -77,7 +75,7 @@ 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(SerializableFailureMechanismSectionCollection), xmlArrayItemAttributes.ElementAt(5).Type); Assert.AreEqual(typeof(SerializableFailureMechanismSection), xmlArrayItemAttributes.ElementAt(6).Type); Assert.AreEqual(typeof(SerializableCombinedFailureMechanismSectionAssembly), xmlArrayItemAttributes.ElementAt(7).Type); } @@ -92,7 +90,14 @@ TestDelegate call = () => new SerializableAssembly(null, new Point2D(random.NextDouble(), random.NextDouble()), new Point2D(random.NextDouble(), random.NextDouble()), - new SerializableFeatureMember[0]); + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty()); // Assert var exception = Assert.Throws(call); @@ -109,7 +114,14 @@ TestDelegate call = () => new SerializableAssembly(string.Empty, null, new Point2D(random.NextDouble(), random.NextDouble()), - new SerializableFeatureMember[0]); + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty()); // Assert var exception = Assert.Throws(call); @@ -126,14 +138,21 @@ TestDelegate call = () => new SerializableAssembly(string.Empty, new Point2D(random.NextDouble(), random.NextDouble()), null, - new SerializableFeatureMember[0]); + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty()); // Assert var exception = Assert.Throws(call); Assert.AreEqual("upperCorner", exception.ParamName); } [Test] - public void Constructor_FeatureMembersNull_ThrowsArgumentNullException() + public void Constructor_AssessmentSectionsNull_ThrowsArgumentNullException() { // Setup var random = new Random(39); @@ -142,10 +161,178 @@ TestDelegate call = () => new SerializableAssembly(string.Empty, new Point2D(random.NextDouble(), random.NextDouble()), new Point2D(random.NextDouble(), random.NextDouble()), + null, + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty()); + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("assessmentSections", exception.ParamName); + } + + [Test] + public void Constructor_AssessmentProcessesNull_ThrowsArgumentNullException() + { + // Setup + var random = new Random(39); + + // Call + TestDelegate call = () => new SerializableAssembly(string.Empty, + new Point2D(random.NextDouble(), random.NextDouble()), + new Point2D(random.NextDouble(), random.NextDouble()), + Enumerable.Empty(), + null, + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty()); + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("assessmentProcesses", exception.ParamName); + } + + [Test] + public void Constructor_TotalAssemblyResultsNull_ThrowsArgumentNullException() + { + // Setup + var random = new Random(39); + + // Call + TestDelegate call = () => new SerializableAssembly(string.Empty, + new Point2D(random.NextDouble(), random.NextDouble()), + new Point2D(random.NextDouble(), random.NextDouble()), + Enumerable.Empty(), + Enumerable.Empty(), + null, + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty()); + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("totalAssemblyResults", exception.ParamName); + } + + [Test] + public void Constructor_FailureMechanismsNull_ThrowsArgumentNullException() + { + // Setup + var random = new Random(39); + + // Call + TestDelegate call = () => new SerializableAssembly(string.Empty, + new Point2D(random.NextDouble(), random.NextDouble()), + new Point2D(random.NextDouble(), random.NextDouble()), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + null, + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty()); + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("failureMechanisms", exception.ParamName); + } + + [Test] + public void Constructor_FailureMechanismSectionAssembliesNull_ThrowsArgumentNullException() + { + // Setup + var random = new Random(39); + + // Call + TestDelegate call = () => new SerializableAssembly(string.Empty, + new Point2D(random.NextDouble(), random.NextDouble()), + new Point2D(random.NextDouble(), random.NextDouble()), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + null, + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty()); + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("failureMechanismSectionAssemblies", exception.ParamName); + } + + [Test] + public void Constructor_CombinedFailureMechanismSectionAssembliesNull_ThrowsArgumentNullException() + { + // Setup + var random = new Random(39); + + // Call + TestDelegate call = () => new SerializableAssembly(string.Empty, + new Point2D(random.NextDouble(), random.NextDouble()), + new Point2D(random.NextDouble(), random.NextDouble()), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + null, + Enumerable.Empty(), + Enumerable.Empty()); + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("combinedFailureMechanismSectionAssemblies", exception.ParamName); + } + + [Test] + public void Constructor_FailureMechanismSectionCollectionsNull_ThrowsArgumentNullException() + { + // Setup + var random = new Random(39); + + // Call + TestDelegate call = () => new SerializableAssembly(string.Empty, + new Point2D(random.NextDouble(), random.NextDouble()), + new Point2D(random.NextDouble(), random.NextDouble()), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + null, + Enumerable.Empty()); + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("failureMechanismSectionCollections", exception.ParamName); + } + + [Test] + public void Constructor_FailureMechanismSectionsNull_ThrowsArgumentNullException() + { + // Setup + var random = new Random(39); + + // Call + TestDelegate call = () => new SerializableAssembly(string.Empty, + new Point2D(random.NextDouble(), random.NextDouble()), + new Point2D(random.NextDouble(), random.NextDouble()), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), null); // Assert var exception = Assert.Throws(call); - Assert.AreEqual("featureMembers", exception.ParamName); + Assert.AreEqual("failureMechanismSections", exception.ParamName); } [Test] @@ -157,23 +344,69 @@ var random = new Random(39); var lowerCorner = new Point2D(random.NextDouble(), random.NextDouble()); var upperCorner = new Point2D(random.NextDouble(), random.NextDouble()); - var featureMember = new TestFeatureMember(); + var assessmentSection = new SerializableAssessmentSection(); + var assessmentProcess = new SerializableAssessmentProcess(); + var totalAssemblyResult = new SerializableTotalAssemblyResult(); + var failureMechanism = new SerializableFailureMechanism(); + var failureMechanismSectionAssembly = new SerializableFailureMechanismSectionAssembly(); + var combinedFailureMechanismSectionAssembly = new SerializableCombinedFailureMechanismSectionAssembly(); + var failureMechanismSections = new SerializableFailureMechanismSectionCollection(); + var failureMechanismSection = new SerializableFailureMechanismSection(); // Call + var assembly = new SerializableAssembly(id, lowerCorner, upperCorner, - new SerializableFeatureMember[] + new[] { - featureMember + assessmentSection + }, + new[] + { + assessmentProcess + }, + new[] + { + totalAssemblyResult + }, + new[] + { + failureMechanism + }, + new[] + { + failureMechanismSectionAssembly + }, + new[] + { + combinedFailureMechanismSectionAssembly + }, + new[] + { + failureMechanismSections + }, + new[] + { + failureMechanismSection }); // Assert Assert.AreEqual(id, assembly.Id); Assert.AreEqual(lowerCorner.X.ToString(CultureInfo.InvariantCulture) + " " + lowerCorner.Y.ToString(CultureInfo.InvariantCulture), assembly.Boundary.Envelope.LowerCorner); Assert.AreEqual(upperCorner.X.ToString(CultureInfo.InvariantCulture) + " " + upperCorner.Y.ToString(CultureInfo.InvariantCulture), assembly.Boundary.Envelope.UpperCorner); - Assert.AreSame(featureMember, assembly.FeatureMembers.Single()); + CollectionAssert.AreEqual(new SerializableFeatureMember[] + { + assessmentSection, + assessmentProcess, + totalAssemblyResult, + failureMechanism, + failureMechanismSectionAssembly, + combinedFailureMechanismSectionAssembly, + failureMechanismSections, + failureMechanismSection + }, assembly.FeatureMembers); } [Test] @@ -208,13 +441,13 @@ new SerializableFailureMechanismAssemblyResult(SerializableAssemblyMethod.WBI3C1, SerializableFailureMechanismCategoryGroup.NotApplicable, 0.000124), new SerializableAssessmentSectionAssemblyResult(SerializableAssemblyMethod.WBI2C1, SerializableAssessmentSectionCategoryGroup.B)); - var failureMechanism1 = new SerializableFailureMechanism("toetsspoorGABI", - totalAssemblyResult, - SerializableFailureMechanismType.GABI, - SerializableAssemblyGroup.Group4, - new SerializableFailureMechanismAssemblyResult(SerializableAssemblyMethod.WBI1A1, SerializableFailureMechanismCategoryGroup.IIt)); + var failureMechanism = new SerializableFailureMechanism("toetsspoorGABI", + totalAssemblyResult, + SerializableFailureMechanismType.GABI, + SerializableAssemblyGroup.Group4, + new SerializableFailureMechanismAssemblyResult(SerializableAssemblyMethod.WBI1A1, SerializableFailureMechanismCategoryGroup.IIt)); - var sections1 = new SerializableFailureMechanismSections("vakindelingGABI", failureMechanism1); + var sections1 = new SerializableFailureMechanismSectionCollection("vakindelingGABI", failureMechanism); var section1 = new SerializableFailureMechanismSection("vak_GABI_1", sections1, 0.12, @@ -225,17 +458,17 @@ new Point2D(10.23, 10.24) }); - var result1 = new SerializableFailureMechanismSectionAssembly("resultaat_GABI_1", - failureMechanism1, - section1, - new[] - { - new SerializableFailureMechanismSectionAssemblyResult(SerializableAssemblyMethod.WBI0E1, SerializableAssessmentLevel.SimpleAssessment, SerializableFailureMechanismSectionCategoryGroup.IIv, 0.5), - new SerializableFailureMechanismSectionAssemblyResult(SerializableAssemblyMethod.WBI0T5, SerializableAssessmentLevel.TailorMadeAssessment, SerializableFailureMechanismSectionCategoryGroup.IIIv) - }, - new SerializableFailureMechanismSectionAssemblyResult(SerializableAssemblyMethod.WBI0A1, SerializableAssessmentLevel.CombinedAssessment, SerializableFailureMechanismSectionCategoryGroup.IIIv)); + var result = new SerializableFailureMechanismSectionAssembly("resultaat_GABI_1", + failureMechanism, + section1, + new[] + { + new SerializableFailureMechanismSectionAssemblyResult(SerializableAssemblyMethod.WBI0E1, SerializableAssessmentLevel.SimpleAssessment, SerializableFailureMechanismSectionCategoryGroup.IIv, 0.5), + new SerializableFailureMechanismSectionAssemblyResult(SerializableAssemblyMethod.WBI0T5, SerializableAssessmentLevel.TailorMadeAssessment, SerializableFailureMechanismSectionCategoryGroup.IIIv) + }, + new SerializableFailureMechanismSectionAssemblyResult(SerializableAssemblyMethod.WBI0A1, SerializableAssessmentLevel.CombinedAssessment, SerializableFailureMechanismSectionCategoryGroup.IIIv)); - var sections2 = new SerializableFailureMechanismSections("vakindeling_gecombineerd", totalAssemblyResult); + var sections2 = new SerializableFailureMechanismSectionCollection("vakindeling_gecombineerd", totalAssemblyResult); var section2 = new SerializableFailureMechanismSection("vak_gecombineerd_1", sections2, 0.12, @@ -257,16 +490,37 @@ 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[] + new[] { - assessmentSection, - assessmentProcess, - totalAssemblyResult, - failureMechanism1, - result1, - combinedResult, + assessmentSection + }, + new[] + { + assessmentProcess + }, + new[] + { + totalAssemblyResult + }, + new[] + { + failureMechanism + }, + new[] + { + result + }, + new[] + { + combinedResult + }, + new[] + { sections1, - sections2, + sections2 + }, + new[] + { section1, section2 }); Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableCombinedFailureMechanismSectionAssemblyTest.cs =================================================================== diff -u -r5e2248b589fcb4b39e7ff664cd11a200b08daa28 -r2a28064a44daa277c25e597f4b3eea1edd52e37c --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableCombinedFailureMechanismSectionAssemblyTest.cs (.../SerializableCombinedFailureMechanismSectionAssemblyTest.cs) (revision 5e2248b589fcb4b39e7ff664cd11a200b08daa28) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableCombinedFailureMechanismSectionAssemblyTest.cs (.../SerializableCombinedFailureMechanismSectionAssemblyTest.cs) (revision 2a28064a44daa277c25e597f4b3eea1edd52e37c) @@ -146,7 +146,7 @@ new SerializableFailureMechanismAssemblyResult(), new SerializableAssessmentSectionAssemblyResult()); var section = new SerializableFailureMechanismSection("section ID", - new SerializableFailureMechanismSections(), + new SerializableFailureMechanismSectionCollection(), random.NextDouble(), random.NextDouble(), new[] Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableFailureMechanismSectionAssemblyTest.cs =================================================================== diff -u -r7e15e5a8f543e9951e8a4ce5706dc32e073b1cdf -r2a28064a44daa277c25e597f4b3eea1edd52e37c --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableFailureMechanismSectionAssemblyTest.cs (.../SerializableFailureMechanismSectionAssemblyTest.cs) (revision 7e15e5a8f543e9951e8a4ce5706dc32e073b1cdf) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableFailureMechanismSectionAssemblyTest.cs (.../SerializableFailureMechanismSectionAssemblyTest.cs) (revision 2a28064a44daa277c25e597f4b3eea1edd52e37c) @@ -20,7 +20,6 @@ // All rights reserved. using System; -using System.Linq; using Core.Common.Base.Geometry; using Core.Common.TestUtil; using NUnit.Framework; @@ -149,12 +148,12 @@ random.NextEnumValue(), new SerializableFailureMechanismAssemblyResult()); var section = new SerializableFailureMechanismSection("section ID", - new SerializableFailureMechanismSections(), + new SerializableFailureMechanismSectionCollection(), random.NextDouble(), random.NextDouble(), - new [] + new[] { - new Point2D(random.NextDouble(), random.NextDouble()) + new Point2D(random.NextDouble(), random.NextDouble()) }); var sectionResults = new SerializableFailureMechanismSectionAssemblyResult[0]; var combinedSectionResult = new SerializableFailureMechanismSectionAssemblyResult(); Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableFailureMechanismSectionTest.cs =================================================================== diff -u -r48a70fa6c4d7f5a73e2b2d10fe074f2ec7321a82 -r2a28064a44daa277c25e597f4b3eea1edd52e37c --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableFailureMechanismSectionTest.cs (.../SerializableFailureMechanismSectionTest.cs) (revision 48a70fa6c4d7f5a73e2b2d10fe074f2ec7321a82) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableFailureMechanismSectionTest.cs (.../SerializableFailureMechanismSectionTest.cs) (revision 2a28064a44daa277c25e597f4b3eea1edd52e37c) @@ -43,7 +43,7 @@ // Assert Assert.IsInstanceOf(section); Assert.IsNull(section.Id); - Assert.IsNull(section.FailureMechanismSectionsId); + Assert.IsNull(section.FailureMechanismSectionCollectionId); Assert.IsNull(section.StartDistance); Assert.IsNull(section.EndDistance); Assert.IsNull(section.Geometry); @@ -52,7 +52,7 @@ SerializableAttributeTestHelper.AssertXmlAttributeAttribute( nameof(SerializableFailureMechanismSection.Id), "id", "http://www.opengis.net/gml/3.2"); SerializableAttributeTestHelper.AssertXmlAttributeAttribute( - nameof(SerializableFailureMechanismSection.FailureMechanismSectionsId), "VakindelingIDRef"); + nameof(SerializableFailureMechanismSection.FailureMechanismSectionCollectionId), "VakindelingIDRef"); SerializableAttributeTestHelper.AssertXmlElementAttribute( nameof(SerializableFailureMechanismSection.StartDistance), "afstandBegin"); @@ -76,7 +76,7 @@ // Call TestDelegate call = () => new SerializableFailureMechanismSection(null, - new SerializableFailureMechanismSections(), + new SerializableFailureMechanismSectionCollection(), random.NextDouble(), random.NextDouble(), Enumerable.Empty()); @@ -87,7 +87,7 @@ } [Test] - public void Constructor_FailureMechanismSectionsNull_ThrowsArgumentNullException() + public void Constructor_FailureMechanismSectionCollectionNull_ThrowsArgumentNullException() { // Setup var random = new Random(39); @@ -101,7 +101,7 @@ // Assert var exception = Assert.Throws(call); - Assert.AreEqual("failureMechanismSections", exception.ParamName); + Assert.AreEqual("failureMechanismSectionCollection", exception.ParamName); } [Test] @@ -112,7 +112,7 @@ // Call TestDelegate call = () => new SerializableFailureMechanismSection("id", - new SerializableFailureMechanismSections(), + new SerializableFailureMechanismSectionCollection(), random.NextDouble(), random.NextDouble(), null); @@ -129,7 +129,7 @@ const string id = "section id"; var random = new Random(39); - var sections = new SerializableFailureMechanismSections("sections id", new SerializableFailureMechanism()); + var sectionCollection = new SerializableFailureMechanismSectionCollection("sections id", new SerializableFailureMechanism()); double startDistance = random.NextDouble(); double endDistance = random.NextDouble(); var assemblyMethod = random.NextEnumValue(); @@ -141,15 +141,15 @@ // Call var section = new SerializableFailureMechanismSection(id, - sections, + sectionCollection, startDistance, endDistance, geometry, assemblyMethod); // Assert Assert.AreEqual(id, section.Id); - Assert.AreEqual(sections.Id, section.FailureMechanismSectionsId); + Assert.AreEqual(sectionCollection.Id, section.FailureMechanismSectionCollectionId); Assert.AreEqual("m", section.StartDistance.UnitOfMeasure); Assert.AreEqual(startDistance, section.StartDistance.Value); Assert.AreEqual("m", section.EndDistance.UnitOfMeasure); @@ -169,7 +169,7 @@ // Setup var random = new Random(39); var section = new SerializableFailureMechanismSection("id", - new SerializableFailureMechanismSections(), + new SerializableFailureMechanismSectionCollection(), random.NextDouble(), random.NextDouble(), new[] Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableFailureMechanismSectionsTest.cs =================================================================== diff -u -rc484779318d146c81093706412e60860ee423295 -r2a28064a44daa277c25e597f4b3eea1edd52e37c --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableFailureMechanismSectionsTest.cs (.../SerializableFailureMechanismSectionsTest.cs) (revision c484779318d146c81093706412e60860ee423295) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableFailureMechanismSectionsTest.cs (.../SerializableFailureMechanismSectionsTest.cs) (revision 2a28064a44daa277c25e597f4b3eea1edd52e37c) @@ -36,28 +36,28 @@ public void DefaultConstructor_ReturnsDefaultValues() { // Call - var sections = new SerializableFailureMechanismSections(); + var sections = new SerializableFailureMechanismSectionCollection(); // Assert Assert.IsInstanceOf(sections); Assert.IsNull(sections.Id); Assert.IsNull(sections.FailureMechanismId); Assert.IsNull(sections.TotalAssemblyResultId); - SerializableAttributeTestHelper.AssertXmlAttributeAttribute( - nameof(SerializableFailureMechanismSections.Id), "VakindelingID"); - SerializableAttributeTestHelper.AssertXmlAttributeAttribute( - nameof(SerializableFailureMechanismSections.FailureMechanismId), "ToetsspoorIDRef"); - SerializableAttributeTestHelper.AssertXmlAttributeAttribute( - nameof(SerializableFailureMechanismSections.TotalAssemblyResultId), "VeiligheidsoordeelIDRef"); + SerializableAttributeTestHelper.AssertXmlAttributeAttribute( + nameof(SerializableFailureMechanismSectionCollection.Id), "VakindelingID"); + SerializableAttributeTestHelper.AssertXmlAttributeAttribute( + nameof(SerializableFailureMechanismSectionCollection.FailureMechanismId), "ToetsspoorIDRef"); + SerializableAttributeTestHelper.AssertXmlAttributeAttribute( + nameof(SerializableFailureMechanismSectionCollection.TotalAssemblyResultId), "VeiligheidsoordeelIDRef"); } [Test] public void ConstructorWithFailureMechanism_IdNull_ThrowsArgumentNullException() { // Call - TestDelegate call = () => new SerializableFailureMechanismSections(null, - new SerializableFailureMechanism()); + TestDelegate call = () => new SerializableFailureMechanismSectionCollection(null, + new SerializableFailureMechanism()); // Assert var exception = Assert.Throws(call); @@ -68,8 +68,8 @@ public void ConstructorWithFailureMechanism_FailureMechanismNull_ThrowsArgumentNullException() { // Call - TestDelegate call = () => new SerializableFailureMechanismSections("id", - (SerializableFailureMechanism) null); + TestDelegate call = () => new SerializableFailureMechanismSectionCollection("id", + (SerializableFailureMechanism) null); // Assert var exception = Assert.Throws(call); @@ -90,8 +90,8 @@ new SerializableFailureMechanismAssemblyResult()); // Call - var sections = new SerializableFailureMechanismSections(id, - failureMechanism); + var sections = new SerializableFailureMechanismSectionCollection(id, + failureMechanism); // Assert Assert.AreEqual(id, sections.Id); @@ -103,8 +103,8 @@ public void ConstructorWithTotalAssemblyResult_IdNull_ThrowsArgumentNullException() { // Call - TestDelegate call = () => new SerializableFailureMechanismSections(null, - new SerializableTotalAssemblyResult()); + TestDelegate call = () => new SerializableFailureMechanismSectionCollection(null, + new SerializableTotalAssemblyResult()); // Assert var exception = Assert.Throws(call); @@ -115,8 +115,8 @@ public void ConstructorWithTotalAssemblyResult_FailureMechanismNull_ThrowsArgumentNullException() { // Call - TestDelegate call = () => new SerializableFailureMechanismSections("id", - (SerializableTotalAssemblyResult) null); + TestDelegate call = () => new SerializableFailureMechanismSectionCollection("id", + (SerializableTotalAssemblyResult) null); // Assert var exception = Assert.Throws(call); @@ -136,8 +136,8 @@ new SerializableAssessmentSectionAssemblyResult()); // Call - var sections = new SerializableFailureMechanismSections(id, - totalAssemblyResult); + var sections = new SerializableFailureMechanismSectionCollection(id, + totalAssemblyResult); // Assert Assert.AreEqual(id, sections.Id); Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/SerializableAssemblyWriterTest.cs =================================================================== diff -u -r9ad4c9daea5f2a20f2cc61df9ea79d1144d84b2e -r2a28064a44daa277c25e597f4b3eea1edd52e37c --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/SerializableAssemblyWriterTest.cs (.../SerializableAssemblyWriterTest.cs) (revision 9ad4c9daea5f2a20f2cc61df9ea79d1144d84b2e) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/SerializableAssemblyWriterTest.cs (.../SerializableAssemblyWriterTest.cs) (revision 2a28064a44daa277c25e597f4b3eea1edd52e37c) @@ -21,6 +21,7 @@ using System; using System.IO; +using System.Linq; using System.Security.AccessControl; using System.Text; using System.Xml.Serialization; @@ -69,10 +70,17 @@ "id", new Point2D(0.0, 10.0), new Point2D(10.0, 20.0), - new SerializableFeatureMember[] + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + new [] { - new SerializableFailureMechanism() - }); + new SerializableFailureMechanism() + }, + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty()); try { @@ -172,11 +180,23 @@ "id", new Point2D(0.0, 10.0), new Point2D(10.0, 20.0), - new SerializableFeatureMember[] + new[] { - new SerializableAssessmentSection(), + new SerializableAssessmentSection() + }, + new[] + { new SerializableAssessmentProcess() - }); + }, + new[] + { + new SerializableTotalAssemblyResult() + }, + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty(), + Enumerable.Empty()); try {