Exemple #1
0
        public void ExceptionUnwrapStringTest()
        {
            var lv0 = new ArgumentNullException("name", "lv0");
            var lv1 = new InvalidOperationException("lv1", lv0);
            var lv2 = new ArgumentException("lv1", lv1);
            var lv3 = new ArgumentException("lv2", lv2);
            var lv4 = new ArgumentException("lv3", lv3);
            var lv5 = new ArgumentException("lv4", lv4);
            var lvZ = new ValidationException(1000, "lvZ", lv5);

            var lvA = lv5.ToUnwrappedString();
            var lvB = lv5.ToFullUnwrappedString();
            var lvC = lvZ.ToUnwrappedString();
            var lvD = lvZ.ToFullUnwrappedString();

            var fullMessage =
#if NETFRAMEWORK
                @"lvZ
lv0
Parameter name: name";
#else
                @"lvZ
lv0 (Parameter 'name')";
#endif

            lvA.ShouldBe(lv0.Message);
            lvB.ShouldBe(lv0.Message);
            lvC.ShouldBe(lv0.Message);
            lvD.ShouldBe(fullMessage);
        }