Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/CalculationServiceHelperTest.cs =================================================================== diff -u -r92210258706d0f57e05552037b676bd941a6fe19 -re2786bbbad5456a4b42b68e1d0b0f85f732393d7 --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/CalculationServiceHelperTest.cs (.../CalculationServiceHelperTest.cs) (revision 92210258706d0f57e05552037b676bd941a6fe19) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/CalculationServiceHelperTest.cs (.../CalculationServiceHelperTest.cs) (revision e2786bbbad5456a4b42b68e1d0b0f85f732393d7) @@ -22,6 +22,7 @@ using System; using System.Linq; using Core.Common.TestUtil; +using log4net.Core; using NUnit.Framework; using Ringtoets.Common.Service.TestUtil; @@ -203,5 +204,46 @@ // Assert Assert.IsFalse(errorOccurred); } + + [Test] + public void LogExceptionAsError_MessageNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => CalculationServiceHelper.LogExceptionAsError(null, new Exception()); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("message", exception.ParamName); + } + + [Test] + public void LogExceptionAsError_ExceptionNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => CalculationServiceHelper.LogExceptionAsError("message", null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("exception", exception.ParamName); + } + + [Test] + public void LogExceptionAsError_WithParameters_LogMessageAndException() + { + // Setup + const string message = "Message"; + + // Call + Action call = () => CalculationServiceHelper.LogExceptionAsError(message, new Exception()); + + // Assert + TestHelper.AssertLogMessagesWithLevelAndLoggedExceptions(call, tuples => + { + Tuple tuple = tuples.Single(); + Assert.AreEqual(message, tuple.Item1); + Assert.AreEqual(Level.Error, tuple.Item2); + Assert.IsInstanceOf(tuple.Item3); + }); + } } } \ No newline at end of file