示例#1
0
        public static void Ctor_ExceptionRecovery(Lazy <InitiallyExceptionThrowingCtor> lazy, int expected)
        {
            InitiallyExceptionThrowingCtor.counter = 0;
            InitiallyExceptionThrowingCtor result = null;

            for (var i = 0; i < 10; ++i)
            {
                try { result = lazy.Value; } catch (Exception) { }
            }
            Assert.Equal(result.Value, expected);
        }
示例#2
0
 public static void Ctor_ExceptionRecovery()
 {
     foreach (Lazy <InitiallyExceptionThrowingCtor> lazy in Ctor_ExceptionRecovery_MemberData())
     {
         InitiallyExceptionThrowingCtor.counter = 0;
         InitiallyExceptionThrowingCtor result = null;
         for (int i = 0; i < 10; ++i)
         {
             try
             { result = lazy.Value; }
             catch (Exception) { }
         }
         Assert.Equal(5, result.Value);
     }
 }