using System; using NUnit.Framework; using Wti.IO.Exceptions; namespace Wti.IO.Test.Exceptions { [TestFixture] public class CriticalFileReadExceptionTest { [Test] [SetCulture("en-US")] public void DefaultConstructor_ExpectedValues() { // Call var exception = new CriticalFileReadException(); // Assert Assert.IsInstanceOf(exception); var expectedMessage = string.Format("Exception of type '{0}' was thrown.", exception.GetType()); Assert.AreEqual(expectedMessage, exception.Message); CollectionAssert.IsEmpty(exception.Data); Assert.IsNull(exception.HelpLink); Assert.IsNull(exception.InnerException); Assert.IsNull(exception.Source); Assert.IsNull(exception.StackTrace); Assert.IsNull(exception.TargetSite); } [Test] public void MessageConstructor_ExpectedValues() { // Setup const string messageText = ""; // Call var exception = new CriticalFileReadException(messageText); // Assert Assert.IsInstanceOf(exception); Assert.AreEqual(messageText, exception.Message); CollectionAssert.IsEmpty(exception.Data); Assert.IsNull(exception.HelpLink); Assert.IsNull(exception.InnerException); Assert.IsNull(exception.Source); Assert.IsNull(exception.StackTrace); Assert.IsNull(exception.TargetSite); } [Test] public void MessageAndInnerExceptionConstructor_ExpectedValues() { // Setup var innerException = new Exception(); const string messageText = ""; // Call var exception = new CriticalFileReadException(messageText, innerException); // Assert Assert.IsInstanceOf(exception); Assert.AreEqual(messageText, exception.Message); CollectionAssert.IsEmpty(exception.Data); Assert.IsNull(exception.HelpLink); Assert.AreEqual(innerException, exception.InnerException); Assert.IsNull(exception.Source); Assert.IsNull(exception.StackTrace); Assert.IsNull(exception.TargetSite); } } }