Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsSoilLayer2DTest.cs =================================================================== diff -u -ra07b01c421d15a0a1e4933e3967ac1f25d30eccc -r1a3f904157a3f86e702ea8086bee67e780da7856 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsSoilLayer2DTest.cs (.../MacroStabilityInwardsSoilLayer2DTest.cs) (revision a07b01c421d15a0a1e4933e3967ac1f25d30eccc) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsSoilLayer2DTest.cs (.../MacroStabilityInwardsSoilLayer2DTest.cs) (revision 1a3f904157a3f86e702ea8086bee67e780da7856) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using System.Collections.Generic; using System.Drawing; using System.Linq; using Core.Common.Base.Geometry; @@ -35,7 +36,7 @@ public class MacroStabilityInwardsSoilLayer2DTest { [Test] - public void Constructor_OuterRingNullWithoutData_ThrowsArgumentNullException() + public void Constructor_OuterRingNullWithoutDataAndNestedLayers_ThrowsArgumentNullException() { // Setup var holes = new[] @@ -56,7 +57,7 @@ } [Test] - public void Constructor_OuterRingNullWithData_ThrowsArgumentNullException() + public void Constructor_OuterRingNullWithDataAndNestedLayers_ThrowsArgumentNullException() { // Setup var holes = new[] @@ -69,15 +70,18 @@ }; // Call - TestDelegate test = () => new MacroStabilityInwardsSoilLayer2D(null, holes, new MacroStabilityInwardsSoilLayerData()); + TestDelegate test = () => new MacroStabilityInwardsSoilLayer2D(null, + holes, + new MacroStabilityInwardsSoilLayerData(), + Enumerable.Empty()); // Assert var exception = Assert.Throws(test); Assert.AreEqual("outerRing", exception.ParamName); } [Test] - public void Constructor_HolesNullWithoutData_ThrowsArgumentNullException() + public void Constructor_HolesNullWithoutDataAndNestedLayers_ThrowsArgumentNullException() { // Setup var outerRing = new Ring(new[] @@ -95,7 +99,7 @@ } [Test] - public void Constructor_HolesNullWithData_ThrowsArgumentNullException() + public void Constructor_HolesNullWithDataAndNestedLayers_ThrowsArgumentNullException() { // Setup var outerRing = new Ring(new[] @@ -105,7 +109,10 @@ }); // Call - TestDelegate test = () => new MacroStabilityInwardsSoilLayer2D(outerRing, null, new MacroStabilityInwardsSoilLayerData()); + TestDelegate test = () => new MacroStabilityInwardsSoilLayer2D(outerRing, + null, + new MacroStabilityInwardsSoilLayerData(), + Enumerable.Empty()); // Assert var exception = Assert.Throws(test); @@ -124,14 +131,33 @@ }; // Call - TestDelegate test = () => new MacroStabilityInwardsSoilLayer2D(outerRing, holes, null); + TestDelegate test = () => new MacroStabilityInwardsSoilLayer2D(outerRing, holes, null, Enumerable.Empty()); // Assert var exception = Assert.Throws(test); Assert.AreEqual("data", exception.ParamName); } [Test] + public void Constructor_NestedLayersNull_ThrowsArgumentNullException() + { + // Setup + var random = new Random(39); + Ring outerRing = CreateRandomRing(random); + var holes = new[] + { + CreateRandomRing(random) + }; + + // Call + TestDelegate test = () => new MacroStabilityInwardsSoilLayer2D(outerRing, holes, new MacroStabilityInwardsSoilLayerData(), null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("nestedLayers", exception.ParamName); + } + + [Test] public void Constructor_WithOuterRingAndHoles_ReturnsNewInstance() { // Setup @@ -152,10 +178,11 @@ Assert.AreNotSame(holes, layer.Holes); TestHelper.AssertCollectionsAreEqual(holes, layer.Holes, new ReferenceEqualityComparer()); Assert.IsNotNull(layer.Data); + Assert.IsEmpty(layer.NestedLayers); } [Test] - public void Constructor_WithOuterRingHolesAndData_ReturnsNewInstance() + public void Constructor_WithOuterRingHolesDataAndNestedLayers_ReturnsNewInstance() { // Setup var random = new Random(39); @@ -165,9 +192,10 @@ CreateRandomRing(random) }; var data = new MacroStabilityInwardsSoilLayerData(); + IEnumerable nestedLayers = Enumerable.Empty(); // Call - var layer = new MacroStabilityInwardsSoilLayer2D(outerRing, holes, data); + var layer = new MacroStabilityInwardsSoilLayer2D(outerRing, holes, data, nestedLayers); // Assert Assert.IsInstanceOf(layer); @@ -176,6 +204,7 @@ Assert.AreNotSame(holes, layer.Holes); TestHelper.AssertCollectionsAreEqual(holes, layer.Holes, new ReferenceEqualityComparer()); Assert.AreSame(data, layer.Data); + Assert.AreSame(nestedLayers, layer.NestedLayers); } [Test] @@ -345,8 +374,7 @@ Data = { Color = Color.FromKnownColor(random.NextEnumValue()) - }, - NestedLayers = Enumerable.Empty() + } }; }