Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/SoilProfile2DReaderTest.cs =================================================================== diff -u -rd2b5b334c49948fa49297a1d24c13bc98aa6ee1e -r0047bcf51f94a295f3e4854f9b93594ad01a9e70 --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/SoilProfile2DReaderTest.cs (.../SoilProfile2DReaderTest.cs) (revision d2b5b334c49948fa49297a1d24c13bc98aa6ee1e) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/SoilProfile2DReaderTest.cs (.../SoilProfile2DReaderTest.cs) (revision 0047bcf51f94a295f3e4854f9b93594ad01a9e70) @@ -1,5 +1,6 @@ using System; using System.Linq; +using System.Xml; using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Piping.IO.Exceptions; @@ -14,14 +15,14 @@ private MockRepository mocks; private IRowBasedDatabaseReader reader; - private readonly byte[] someGeometry = StringGeometryHelper.GetBytes("" + - "" + - "001.1101.1" + - "" + - "" + - "001.1101.1" + - "" + - ""); + private readonly byte[] someGeometry = StringGeometryHelper.GetByteArray("" + + "" + + "001.1101.1" + + "" + + "" + + "001.1101.1" + + "" + + ""); [SetUp] public void SetUp() @@ -110,12 +111,10 @@ } [Test] - [TestCase(new byte[0])] - [TestCase(null)] - public void ReadFrom_EmptyGeometry_ThrowsPipingSoilProfileReadException(byte[] geometry) + public void ReadFrom_NullGeometry_ThrowsPipingSoilProfileReadException() { // Setup - SetExpectations(1, "", 0.0, 1.0, 0.0, 0.0, 0.0, geometry); + SetExpectations(1, "", 0.0, 1.0, 0.0, 0.0, 0.0, null); mocks.ReplayAll(); @@ -124,6 +123,24 @@ // Assert var exception = Assert.Throws(test); + StringAssert.StartsWith("De geometrie is leeg.", exception.Message); + + mocks.VerifyAll(); + } + + [Test] + public void ReadFrom_EmptyGeometry_ThrowsPipingSoilProfileReadException() + { + // Setup + SetExpectations(1, "", 0.0, 1.0, 0.0, 0.0, 0.0, new byte[0]); + + mocks.ReplayAll(); + + // Call + TestDelegate test = () => SoilProfile2DReader.ReadFrom(reader); + + // Assert + var exception = Assert.Throws(test); Assert.AreEqual("Het XML-document dat de geometrie beschrijft voor de laag is niet geldig.", exception.Message); mocks.VerifyAll();