예제 #1
0
        public void FormatExceptionMessageTest()
        {
            string message            = "Test Message: {handlingInstanceID}";
            Guid   handlingInstanceID = Guid.NewGuid();

            message = MockExceptionHandler.FormatExceptionMessage(message, handlingInstanceID);

            Assert.AreEqual("Test Message: " + handlingInstanceID.ToString(), message);
        }
        public void CustomHandlerTest()
        {
            MockExceptionHandler.Clear();
            Exception originalException = new ArgumentNullException();
            Exception customException   = null;

            try
            {
                ExceptionPolicy.HandleException(originalException, "Custom Policy");
            }
            catch (Exception ex)
            {
                customException = ex;
            }
            Assert.IsNotNull(customException);
            Assert.AreEqual(2, MockExceptionHandler.attributes.Count);
            Assert.AreEqual("32", MockExceptionHandler.attributes["Age"]);
            Assert.AreEqual(typeof(ArgumentNullException), customException.GetType());
            MockExceptionHandler.Clear();
        }
예제 #3
0
 public void Setup()
 {
     MockExceptionHandler.Clear();
 }
 public void Cleanup()
 {
     ExceptionPolicy.Reset();
     MockExceptionHandler.Clear();
 }