Ejemplo n.º 1
0
        public void TestExceptionExtensions()
        {
            Exception exception = new Exception("Test Exception");

            Assert.AreEqual("Test Exception\r\nSuffix", exception.AppendMessage("Suffix").Message, "AppendMessage()");
            Assert.AreEqual("Prefix\r\nTest Exception\r\nSuffix", exception.PrefixMessage("Prefix").Message, "PrefixMessage()");
            Assert.AreEqual("Replaced Message", exception.ReplaceMessage("Replaced Message").Message, "ReplaceMessage()");
            Assert.IsTrue(exception.WithStackTrace().WithStackTrace().StackTrace.Length > 10, "WithStackTrace()");
            exception.AppendInnerException(new Exception("InnerException"));
            exception.AppendInnerException(new Exception("InnerException 2"));
            Assert.AreEqual("Exception: Replaced Message / InnerException / InnerException 2", exception.FullMessage(), "FullMessage()");
        }