Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Creators/SerializableAssemblyCreator.cs
===================================================================
diff -u -rf33ee67efb62e6be7e9d804bd8db91a5ebda75d7 -rf189cc6ae9ce8eee88876ff454af0ed1f2866c68
--- Ringtoets/Integration/src/Ringtoets.Integration.IO/Creators/SerializableAssemblyCreator.cs (.../SerializableAssemblyCreator.cs) (revision f33ee67efb62e6be7e9d804bd8db91a5ebda75d7)
+++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Creators/SerializableAssemblyCreator.cs (.../SerializableAssemblyCreator.cs) (revision f189cc6ae9ce8eee88876ff454af0ed1f2866c68)
@@ -54,9 +54,7 @@
var idGenerator = new UniqueIdentifierGenerator();
string serializableAssemblyId = idGenerator.GetNewId();
- SerializableAssessmentSection serializableAssessmentSection = SerializableAssessmentSectionCreator.Create(idGenerator,
- assessmentSection.Name,
- assessmentSection.Geometry);
+ SerializableAssessmentSection serializableAssessmentSection = SerializableAssessmentSectionCreator.Create(assessmentSection);
SerializableAssessmentProcess serializableAssessmentProcess = SerializableAssessmentProcessCreator.Create(idGenerator, serializableAssessmentSection);
return new SerializableAssembly(serializableAssemblyId,
Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Creators/SerializableAssessmentSectionCreator.cs
===================================================================
diff -u -r0df4def16c2d4e4cb3be9a65fc94422a602d330c -rf189cc6ae9ce8eee88876ff454af0ed1f2866c68
--- Ringtoets/Integration/src/Ringtoets.Integration.IO/Creators/SerializableAssessmentSectionCreator.cs (.../SerializableAssessmentSectionCreator.cs) (revision 0df4def16c2d4e4cb3be9a65fc94422a602d330c)
+++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Creators/SerializableAssessmentSectionCreator.cs (.../SerializableAssessmentSectionCreator.cs) (revision f189cc6ae9ce8eee88876ff454af0ed1f2866c68)
@@ -20,10 +20,9 @@
// All rights reserved.
using System;
-using System.Collections.Generic;
-using Core.Common.Base.Geometry;
using Ringtoets.AssemblyTool.IO.Model;
-using Ringtoets.Integration.IO.Helpers;
+using Ringtoets.Integration.IO.Assembly;
+using Ringtoets.Integration.IO.Properties;
namespace Ringtoets.Integration.IO.Creators
{
@@ -34,26 +33,22 @@
{
///
/// Creates an instance of
- /// based on its input parameters.
+ /// based on a .
///
- /// The generator to generate an id for the
- /// .
- /// The name of the assessment section.
- /// The geometry of the assessment section.
+ /// The
+ /// to create a for.
/// A .
/// Thrown when any parameter is null.
- public static SerializableAssessmentSection Create(UniqueIdentifierGenerator idGenerator,
- string assessmentSectionName,
- IEnumerable geometry)
+ public static SerializableAssessmentSection Create(ExportableAssessmentSection assessmentSection)
{
- if (idGenerator == null)
+ if (assessmentSection == null)
{
- throw new ArgumentNullException(nameof(idGenerator));
+ throw new ArgumentNullException(nameof(assessmentSection));
}
- return new SerializableAssessmentSection(idGenerator.GetNewId(),
- assessmentSectionName,
- geometry);
+ return new SerializableAssessmentSection($"{Resources.SerializableAssessmentSection_IdPrefix}.{assessmentSection.Id}",
+ assessmentSection.Name,
+ assessmentSection.Geometry);
}
}
}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Properties/Resources.Designer.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.IO/Properties/Resources.Designer.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Properties/Resources.Designer.cs (revision f189cc6ae9ce8eee88876ff454af0ed1f2866c68)
@@ -0,0 +1,93 @@
+// 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.
+
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace Ringtoets.Integration.IO.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Ringtoets.Integration.IO.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Wks.
+ ///
+ internal static string SerializableAssessmentSection_IdPrefix {
+ get {
+ return ResourceManager.GetString("SerializableAssessmentSection_IdPrefix", resourceCulture);
+ }
+ }
+ }
+}
Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Properties/Resources.resx
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.IO/Properties/Resources.resx (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Properties/Resources.resx (revision f189cc6ae9ce8eee88876ff454af0ed1f2866c68)
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Wks
+
+
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj
===================================================================
diff -u -rf33ee67efb62e6be7e9d804bd8db91a5ebda75d7 -rf189cc6ae9ce8eee88876ff454af0ed1f2866c68
--- Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj (.../Ringtoets.Integration.IO.csproj) (revision f33ee67efb62e6be7e9d804bd8db91a5ebda75d7)
+++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj (.../Ringtoets.Integration.IO.csproj) (revision f189cc6ae9ce8eee88876ff454af0ed1f2866c68)
@@ -70,15 +70,25 @@
+
+ True
+ True
+ Resources.resx
+
Copying.licenseheader
-
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
{3BBFD65B-B277-4E50-AE6D-BD24C3434609}
Core.Common.Base
Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Creators/SerializableAssemblyCreatorTest.cs
===================================================================
diff -u -r39fbcdb4cfd610d8c8dccbe1793d8f17fce156c4 -rf189cc6ae9ce8eee88876ff454af0ed1f2866c68
--- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Creators/SerializableAssemblyCreatorTest.cs (.../SerializableAssemblyCreatorTest.cs) (revision 39fbcdb4cfd610d8c8dccbe1793d8f17fce156c4)
+++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Creators/SerializableAssemblyCreatorTest.cs (.../SerializableAssemblyCreatorTest.cs) (revision f189cc6ae9ce8eee88876ff454af0ed1f2866c68)
@@ -87,7 +87,7 @@
Assert.AreEqual(3, serializableAssembly.FeatureMembers.Length);
var serializableAssessmentSection = (SerializableAssessmentSection) serializableAssembly.FeatureMembers[0];
- AssertSerializableAssessmentSection("1", assessmentSectionName, geometry, serializableAssessmentSection);
+ AssertSerializableAssessmentSection($"Wks.{assessmentSectionId}", assessmentSectionName, geometry, serializableAssessmentSection);
var serializableAssessmentProcess = (SerializableAssessmentProcess) serializableAssembly.FeatureMembers[1];
AssertSerializableAssessmentProcess("2", serializableAssessmentSection, serializableAssessmentProcess);
AssertSerializableTotalAssemblyResult("3",
Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Creators/SerializableAssessmentSectionCreatorTest.cs
===================================================================
diff -u -r0526b2313fd2c2bf90766d83f2a815037d01b9c9 -rf189cc6ae9ce8eee88876ff454af0ed1f2866c68
--- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Creators/SerializableAssessmentSectionCreatorTest.cs (.../SerializableAssessmentSectionCreatorTest.cs) (revision 0526b2313fd2c2bf90766d83f2a815037d01b9c9)
+++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Creators/SerializableAssessmentSectionCreatorTest.cs (.../SerializableAssessmentSectionCreatorTest.cs) (revision f189cc6ae9ce8eee88876ff454af0ed1f2866c68)
@@ -21,80 +21,69 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using Core.Common.Base.Geometry;
using NUnit.Framework;
using Ringtoets.AssemblyTool.IO.Model;
using Ringtoets.AssemblyTool.IO.Model.Helpers;
+using Ringtoets.Integration.IO.Assembly;
using Ringtoets.Integration.IO.Creators;
-using Ringtoets.Integration.IO.Helpers;
+using Ringtoets.Integration.IO.TestUtil;
namespace Ringtoets.Integration.IO.Test.Creators
{
[TestFixture]
public class SerializableAssessmentSectionCreatorTest
{
[Test]
- public void Create_IdGeneratorNull_ThrowsArgumentNullException()
+ public void Create_AssessmentSectionNull_ThrowsArgumentNullException()
{
// Call
- TestDelegate call = () => SerializableAssessmentSectionCreator.Create(null,
- string.Empty,
- CreateGeometry());
+ TestDelegate call = () => SerializableAssessmentSectionCreator.Create(null);
// Assert
var exception = Assert.Throws(call);
- Assert.AreEqual("idGenerator", exception.ParamName);
+ Assert.AreEqual("assessmentSection", exception.ParamName);
}
[Test]
- public void Create_AssessmentSectionNameNull_ThrowsArgumentNullException()
+ public void Create_WithAssessmentSection_ReturnsSerializableAssessmentSection()
{
- // Call
- TestDelegate call = () => SerializableAssessmentSectionCreator.Create(new UniqueIdentifierGenerator(),
- null,
- CreateGeometry());
-
- // Assert
- var exception = Assert.Throws(call);
- Assert.AreEqual("name", exception.ParamName);
- }
-
- [Test]
- public void Create_GeometryNull_ThrowsArgumentNullException()
- {
- // Call
- TestDelegate call = () => SerializableAssessmentSectionCreator.Create(new UniqueIdentifierGenerator(),
- string.Empty,
- null);
-
- // Assert
- var exception = Assert.Throws(call);
- Assert.AreEqual("geometry", exception.ParamName);
- }
-
- [Test]
- public void Create_WithValidArguments_ReturnsSerializableAssessmentSection()
- {
// Setup
const string assessmentSectionName = "Assessment Section Name";
+ const string assessmentSectionId = "Assessment Section Id";
- var idGenerator = new UniqueIdentifierGenerator();
- IEnumerable geometry = CreateGeometry();
+ ExportableAssessmentSection assessmentSection = CreateAssessmentSection(assessmentSectionName,
+ assessmentSectionId);
// Call
SerializableAssessmentSection serializableAssessmentSection =
- SerializableAssessmentSectionCreator.Create(idGenerator,
- assessmentSectionName,
- geometry);
+ SerializableAssessmentSectionCreator.Create(assessmentSection);
// Assert
- Assert.AreEqual("0", serializableAssessmentSection.Id);
+ Assert.AreEqual($"Wks.{assessmentSection.Id}", serializableAssessmentSection.Id);
Assert.AreEqual(assessmentSectionName, serializableAssessmentSection.Name);
- Assert.AreEqual(Math2D.Length(geometry), serializableAssessmentSection.ReferenceLineLength.Value);
- Assert.AreEqual(GeometrySerializationFormatter.Format(geometry),
+
+ IEnumerable expectedGeometry = assessmentSection.Geometry;
+ Assert.AreEqual(Math2D.Length(expectedGeometry), serializableAssessmentSection.ReferenceLineLength.Value);
+ Assert.AreEqual(GeometrySerializationFormatter.Format(expectedGeometry),
serializableAssessmentSection.ReferenceLineGeometry.LineString.Geometry);
}
+ private static ExportableAssessmentSection CreateAssessmentSection(string name, string id)
+ {
+ return new ExportableAssessmentSection(name,
+ id,
+ CreateGeometry(),
+ ExportableAssessmentSectionAssemblyResultTestFactory.CreateResult(),
+ ExportableFailureMechanismAssemblyResultTestFactory.CreateResultWithProbability(),
+ ExportableFailureMechanismAssemblyResultTestFactory.CreateResultWithoutProbability(),
+ Enumerable.Empty>(),
+ Enumerable.Empty>(),
+ new ExportableCombinedSectionAssemblyCollection(Enumerable.Empty(),
+ Enumerable.Empty()));
+ }
+
private static IEnumerable CreateGeometry()
{
return new[]