Handle() public method

Handles the exception using the action that was passed into the constructor.
The is null.
public Handle ( Exception exception ) : void
exception System.Exception The exception.
return void
示例#1
0
            public void PerformsHandle()
            {
                var originalException = new ArgumentException("achieved");
                var message = string.Empty;
                var handler = new ExceptionHandler(typeof (ArgumentException), exception => { message = exception.Message; });
                handler.Handle(originalException);

                Assert.AreEqual("achieved", message);
            }
示例#2
0
 public void ThrowsArgumentNullExceptionForHandleNullParameter()
 {
     var handler = new ExceptionHandler(typeof (Exception), exception => { });
     ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => handler.Handle(null));
 }