Exemplo n.º 1
0
        public void Exception_Message_is_included_by_default()
        {
            var ex = new InvalidOperationException("oh noes!", new NullReferenceException());

            var msg = ex.ToLogString();

            Assert.That(msg,
                        Contains.Substring("oh noes!"));
        }
Exemplo n.º 2
0
        public void Exception_InnerExceptions_are_included_by_default()
        {
            var ex = new InvalidOperationException("oh noes!", new NullReferenceException("oh my.", new DataException("oops!")));

            Assert.That(ex.ToLogString(),
                        Contains.Substring("NullReferenceException"));
            Assert.That(ex.ToLogString(),
                        Contains.Substring("DataException"));
        }
Exemplo n.º 3
0
        public void Exception_Data_is_included_by_default()
        {
            var ex = new InvalidOperationException("oh noes!", new NullReferenceException());
            var key = "a very important int";
            ex.Data[key] = 123456;

            var msg = ex.ToLogString();

            Assert.That(msg, Contains.Substring(key));
            Assert.That(msg, Contains.Substring("123456"));
        }