Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs
===================================================================
diff -u -r85cf65b38e2e96810139a8490fec8eb5b95837a6 -re0e0c74dec8ad03ea1a76d77697ef026d99afe7e
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision 85cf65b38e2e96810139a8490fec8eb5b95837a6)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision e0e0c74dec8ad03ea1a76d77697ef026d99afe7e)
@@ -142,7 +142,7 @@
{
failureMechanism.StochasticSoilModels.AddRange(entity.StochasticSoilModelEntities
.OrderBy(ssm => ssm.Order)
- .Select(e => e.Read(collector))
+ .Select(e => e.ReadAsPipingStochasticSoilModel(collector))
.ToArray(),
stochasticSoilModelCollectionSourcePath);
}
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/PipingCalculationEntityReadExtensions.cs
===================================================================
diff -u -ra096cb901099c85dbaafa2dba6c69288464c248e -re0e0c74dec8ad03ea1a76d77697ef026d99afe7e
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/PipingCalculationEntityReadExtensions.cs (.../PipingCalculationEntityReadExtensions.cs) (revision a096cb901099c85dbaafa2dba6c69288464c248e)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/PipingCalculationEntityReadExtensions.cs (.../PipingCalculationEntityReadExtensions.cs) (revision e0e0c74dec8ad03ea1a76d77697ef026d99afe7e)
@@ -105,7 +105,7 @@
if (entity.PipingStochasticSoilProfileEntity != null)
{
- inputParameters.StochasticSoilModel = entity.PipingStochasticSoilProfileEntity.StochasticSoilModelEntity.Read(collector);
+ inputParameters.StochasticSoilModel = entity.PipingStochasticSoilProfileEntity.StochasticSoilModelEntity.ReadAsPipingStochasticSoilModel(collector);
inputParameters.StochasticSoilProfile = entity.PipingStochasticSoilProfileEntity.Read(collector);
}
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StochasticSoilModelEntityReadExtensions.cs
===================================================================
diff -u -r7733004c163f4ccfd4211a5b58d880f5da6df24c -re0e0c74dec8ad03ea1a76d77697ef026d99afe7e
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StochasticSoilModelEntityReadExtensions.cs (.../StochasticSoilModelEntityReadExtensions.cs) (revision 7733004c163f4ccfd4211a5b58d880f5da6df24c)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StochasticSoilModelEntityReadExtensions.cs (.../StochasticSoilModelEntityReadExtensions.cs) (revision e0e0c74dec8ad03ea1a76d77697ef026d99afe7e)
@@ -29,7 +29,7 @@
namespace Application.Ringtoets.Storage.Read
{
///
- /// This class defines extension methods for read operations for a
+ /// This class defines extension methods for read operations for a stochastic soil model
/// based on the .
///
internal static class StochasticSoilModelEntityReadExtensions
@@ -41,31 +41,36 @@
/// The to create for.
/// The object keeping track of read operations.
/// A new .
- /// Thrown when is null.
+ /// Thrown when any input parameter is null.
/// Thrown when
/// of is null or empty.
- internal static PipingStochasticSoilModel Read(this StochasticSoilModelEntity entity,
+ internal static PipingStochasticSoilModel ReadAsPipingStochasticSoilModel(this StochasticSoilModelEntity entity,
ReadConversionCollector collector)
{
+ if (entity == null)
+ {
+ throw new ArgumentNullException(nameof(entity));
+ }
if (collector == null)
{
throw new ArgumentNullException(nameof(collector));
}
+
if (collector.ContainsPipingStochasticSoilModel(entity))
{
return collector.GetPipingStochasticSoilModel(entity);
}
var model = new PipingStochasticSoilModel(entity.Name);
- entity.ReadStochasticSoilProfiles(model, collector);
+ entity.ReadPipingStochasticSoilProfiles(model, collector);
entity.ReadSegmentPoints(model);
collector.Read(entity, model);
return model;
}
- private static void ReadStochasticSoilProfiles(this StochasticSoilModelEntity entity,
+ private static void ReadPipingStochasticSoilProfiles(this StochasticSoilModelEntity entity,
PipingStochasticSoilModel model,
ReadConversionCollector collector)
{
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StochasticSoilModelEntityReadExtensionsTest.cs
===================================================================
diff -u -r7733004c163f4ccfd4211a5b58d880f5da6df24c -re0e0c74dec8ad03ea1a76d77697ef026d99afe7e
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StochasticSoilModelEntityReadExtensionsTest.cs (.../StochasticSoilModelEntityReadExtensionsTest.cs) (revision 7733004c163f4ccfd4211a5b58d880f5da6df24c)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StochasticSoilModelEntityReadExtensionsTest.cs (.../StochasticSoilModelEntityReadExtensionsTest.cs) (revision e0e0c74dec8ad03ea1a76d77697ef026d99afe7e)
@@ -34,23 +34,34 @@
public class StochasticSoilModelEntityReadExtensionsTest
{
[Test]
- public void Read_WithoutCollector_ThrowsArgumentNullException()
+ public void ReadAsPipingStochasticSoilModel_CollectorNull_ThrowsArgumentNullException()
{
// Setup
var entity = new StochasticSoilModelEntity();
// Call
- TestDelegate test = () => entity.Read(null);
+ TestDelegate test = () => entity.ReadAsPipingStochasticSoilModel(null);
// Assert
string parameter = Assert.Throws(test).ParamName;
Assert.AreEqual("collector", parameter);
}
[Test]
+ public void ReadAsPipingStochasticSoilModel_EntityNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => ((StochasticSoilModelEntity)null).ReadAsPipingStochasticSoilModel(new ReadConversionCollector());
+
+ // Assert
+ string parameter = Assert.Throws(test).ParamName;
+ Assert.AreEqual("entity", parameter);
+ }
+
+ [Test]
[TestCase("")]
[TestCase(null)]
- public void Read_StochasticSoilModelSegmentPointXmlNullOrEmpty_ThrowsArgumentException(string xml)
+ public void ReadAsPipingStochasticSoilModel_StochasticSoilModelSegmentPointXmlNullOrEmpty_ThrowsArgumentException(string xml)
{
// Setup
var entity = new StochasticSoilModelEntity
@@ -60,15 +71,15 @@
};
// Call
- TestDelegate test = () => entity.Read(new ReadConversionCollector());
+ TestDelegate test = () => entity.ReadAsPipingStochasticSoilModel(new ReadConversionCollector());
// Assert
string paramName = Assert.Throws(test).ParamName;
Assert.AreEqual("xml", paramName);
}
[Test]
- public void Read_WithCollector_ReturnsNewStochasticSoilModelWithPropertiesSetAndEntityRegistered()
+ public void ReadAsPipingStochasticSoilModel_WithCollector_ReturnsNewStochasticSoilModelWithPropertiesSetAndEntityRegistered()
{
// Setup
const string testName = "testName";
@@ -80,7 +91,7 @@
var collector = new ReadConversionCollector();
// Call
- PipingStochasticSoilModel model = entity.Read(collector);
+ PipingStochasticSoilModel model = entity.ReadAsPipingStochasticSoilModel(collector);
// Assert
Assert.IsNotNull(model);
@@ -89,7 +100,7 @@
}
[Test]
- public void Read_WithCollectorWithPipingStochasticSoilProfiles_ReturnsNewStochasticSoilModelWithPipingStochasticSoilProfiles()
+ public void ReadAsPipingStochasticSoilModel_WithCollectorWithPipingStochasticSoilProfiles_ReturnsNewStochasticSoilModelWithPipingStochasticSoilProfiles()
{
// Setup
var entity = new StochasticSoilModelEntity
@@ -127,7 +138,7 @@
var collector = new ReadConversionCollector();
// Call
- PipingStochasticSoilModel model = entity.Read(collector);
+ PipingStochasticSoilModel model = entity.ReadAsPipingStochasticSoilModel(collector);
// Assert
Assert.AreEqual(2, model.StochasticSoilProfiles.Count);
@@ -139,7 +150,7 @@
}
[Test]
- public void Read_WithCollectorWithStochasticSoilModelSegmentPointEntity_ReturnsNewStochasticSoilModelWithGeometryPoints()
+ public void ReadAsPipingStochasticSoilModel_WithCollectorWithStochasticSoilModelSegmentPointEntity_ReturnsNewStochasticSoilModelWithGeometryPoints()
{
// Setup
var segmentPoints = new[]
@@ -156,14 +167,14 @@
var collector = new ReadConversionCollector();
// Call
- PipingStochasticSoilModel model = entity.Read(collector);
+ PipingStochasticSoilModel model = entity.ReadAsPipingStochasticSoilModel(collector);
// Assert
CollectionAssert.AreEqual(segmentPoints, model.Geometry);
}
[Test]
- public void Read_SameStochasticSoilModelEntityMultipleTimes_ReturnSameStochasticSoilModel()
+ public void ReadAsPipingStochasticSoilModel_SameStochasticSoilModelEntityMultipleTimes_ReturnSameStochasticSoilModel()
{
// Setup
var entity = new StochasticSoilModelEntity
@@ -175,8 +186,8 @@
var collector = new ReadConversionCollector();
// Call
- PipingStochasticSoilModel soilModel1 = entity.Read(collector);
- PipingStochasticSoilModel soilModel2 = entity.Read(collector);
+ PipingStochasticSoilModel soilModel1 = entity.ReadAsPipingStochasticSoilModel(collector);
+ PipingStochasticSoilModel soilModel2 = entity.ReadAsPipingStochasticSoilModel(collector);
// Assert
Assert.AreSame(soilModel1, soilModel2);