Index: test/Plugins/Wti/Wti.Data.Test/PipingSoilProfileTest.cs =================================================================== diff -u --- test/Plugins/Wti/Wti.Data.Test/PipingSoilProfileTest.cs (revision 0) +++ test/Plugins/Wti/Wti.Data.Test/PipingSoilProfileTest.cs (revision 46c2fd882297a1243b82d8cacfbb4fc1881f2157) @@ -0,0 +1,34 @@ +using System; +using System.Collections.ObjectModel; +using NUnit.Framework; + +namespace Wti.Data.Test +{ + public class PipingSoilProfileTest + { + [Test] + [TestCase(1)] + [TestCase(5)] + public void Constructor_WithNameBottomLayers_ReturnsInstanceWithPropsAndEquivalentLayerCollection(int layerCount) + { + // Setup + var name = "Profile"; + var bottom = new Random(22).NextDouble(); + var equivalentLayers = new Collection(); + for (var i = 0; i < layerCount; i++) + { + equivalentLayers.Add(new PipingSoilLayer(0.0)); + } + + // Call + var profile = new PipingSoilProfile(name, bottom, equivalentLayers); + + // Assert + Assert.AreNotSame(equivalentLayers, profile.Layers); + CollectionAssert.AreEquivalent(equivalentLayers, profile.Layers); + Assert.AreEqual(name, profile.Name); + Assert.AreEqual(bottom, profile.Bottom); + } + + } +} \ No newline at end of file Index: test/Plugins/Wti/Wti.IO.Test/Builders/SoilLayer2DTest.cs =================================================================== diff -u --- test/Plugins/Wti/Wti.IO.Test/Builders/SoilLayer2DTest.cs (revision 0) +++ test/Plugins/Wti/Wti.IO.Test/Builders/SoilLayer2DTest.cs (revision 46c2fd882297a1243b82d8cacfbb4fc1881f2157) @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Wti.Data; +using Wti.IO.Builders; + +namespace Wti.IO.Test.Builders +{ + public class SoilLayer2DTest + { + [Test] + public void DefaultConstructor_Always_NotInstantiatedOuterAndInnerLoops() + { + // Call + var result = new SoilLayer2D(); + + // Assert + Assert.IsNull(result.OuterLoop); + Assert.IsNull(result.InnerLoop); + } + + [Test] + public void AsPipingSoilLayers_DefaultConstructed_ReturnsEmptyCollectionWithMaxValueBottom() + { + // Setup + var layer = new SoilLayer2D(); + double bottom; + + // Call + var result = layer.AsPipingSoilLayers(0.0, out bottom); + + // Assert + CollectionAssert.IsEmpty(result); + Assert.AreEqual(double.MaxValue, bottom); + } + + [Test] + public void AsPipingSoilLayers_WithOuterLoopNotIntersectingX_ReturnsEmptyCollectionWithMaxValueBottom() + { + // Setup + var layer = new SoilLayer2D + { + OuterLoop = new HashSet + { + new Point3D + { + X = 0.1, Z = new Random(22).NextDouble() + } + } + }; + double bottom; + + // Call + var result = layer.AsPipingSoilLayers(0.0, out bottom); + + // Assert + CollectionAssert.IsEmpty(result); + Assert.AreEqual(double.MaxValue, bottom); + } + } +} \ No newline at end of file Index: test/Plugins/Wti/Wti.IO.Test/Builders/SoilProfileBuilderTest.cs =================================================================== diff -u --- test/Plugins/Wti/Wti.IO.Test/Builders/SoilProfileBuilderTest.cs (revision 0) +++ test/Plugins/Wti/Wti.IO.Test/Builders/SoilProfileBuilderTest.cs (revision 46c2fd882297a1243b82d8cacfbb4fc1881f2157) @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Wti.Data; +using Wti.IO.Builders; +using Wti.IO.Properties; + +namespace Wti.IO.Test.Builders +{ + public class SoilProfileBuilderTest + { + [Test] + [TestCase(null)] + [TestCase("name")] + public void Constructor_WithNameInvalidX_ThrowsArgumentExcpetion(string name) + { + // Call + TestDelegate test = () => new SoilProfileBuilder(name, double.NaN); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual(Resources.Error_SoilProfileBuilderCantDetermineIntersectAtDoubleNaN, exception.Message); + } + + [Test] + [TestCase(null)] + [TestCase("name")] + public void Constructor_WithNameValidX_ReturnsNewInstance(string name) + { + // Call + var builder = new SoilProfileBuilder(name, 0.0); + + // Assert + Assert.NotNull(builder); + } + + [Test] + public void Build_WithOutLayers_ThrowsArgumentException() + { + // Setup + var profileName = "SomeProfile"; + var builder = new SoilProfileBuilder(profileName, 0.0); + + // Call + TestDelegate test = () => builder.Build(); + + // Assert + Assert.Throws(test); + } + } +} \ No newline at end of file