コード例 #1
0
            public void Exception_InnerExceptions_are_included_by_default()
            {
                var ex = new InvalidOperationException("oh noes!", new NullReferenceException("oh my.", new DataException("oops!")));

                ex.ToDisplayString()
                .Should()
                .Contain("NullReferenceException");
                ex.ToDisplayString()
                .Should()
                .Contain("DataException");
            }
コード例 #2
0
            public void Exception_Message_is_included_by_default()
            {
                var ex = new InvalidOperationException("oh noes!", new NullReferenceException());

                var msg = ex.ToDisplayString();

                msg.Should().Contain("oh noes!");
            }
コード例 #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.ToDisplayString();

                msg.Should().Contain(key);
                msg.Should().Contain("123456");
            }