using System; using NUnit.Framework; using Ringtoets.Piping.IO.Builders; namespace Ringtoets.Piping.IO.Test.Builders { [TestFixture] public class SoilProfileBuilderExceptionTest { [Test] public void DefaultConstructor_InnerExceptionNullAndMessageDefault() { // Setup var expectedMessage = string.Format("Exception of type '{0}' was thrown.", typeof(SoilProfileBuilderException).FullName); // Call var exception = new SoilProfileBuilderException(); // Assert Assert.IsNull(exception.InnerException); Assert.AreEqual(expectedMessage, exception.Message); } [Test] public void Constructor_WithCustomMessage_InnerExceptionNullAndMessageSetToCustom() { // Setup var expectedMessage = "Some exception message"; // Call var exception = new SoilProfileBuilderException(expectedMessage); // Assert Assert.IsNull(exception.InnerException); Assert.AreEqual(expectedMessage, exception.Message); } [Test] public void Constructor_WithCustomMessageAndInnerException_InnerExceptionSetAndMessageSetToCustom() { // Setup var expectedMessage = "Some exception message"; var expectedInnerException = new Exception(); // Call var exception = new SoilProfileBuilderException(expectedMessage, expectedInnerException); // Assert Assert.AreSame(expectedInnerException, exception.InnerException); Assert.AreEqual(expectedMessage, exception.Message); } } }