コード例 #1
0
 // We don't really care how it fails - just that an exception is thrown.
 // Unfortuntely NUnit requires the exact exception type :(
 private static void AssertBuildFails(FakeDateTimeZoneSource.Builder builder)
 {
     try
     {
         builder.Build();
         Assert.Fail("Expected exception");
     }
     catch (Exception)
     {
         // Expected
     }
 }
コード例 #2
0
        // We don't really care how it fails - just that an exception is thrown.
        // Unfortuntely NUnit requires the exact exception type :(
        private static void AssertBuildFails(FakeDateTimeZoneSource.Builder builder)
        {
            bool success = false;

            try
            {
                builder.Build();
                success = true;
            }
            catch (Exception)
            {
                // Expected
            }
            Assert.IsFalse(success);
        }