Exemplo n.º 1
0
        public void Execute_ExceptionThrownInExecuteCore_ErrorEventFired()
        {
            CreateActionWithExceptionThrownInExecuteCore();
            var expectedException = new Exception("ExecuteCore error");

            exceptionThrowingAction.ExceptionToThrowInExecuteCore = expectedException;

            Exception exception = Assert.Throws <Exception>(() => exceptionThrowingAction.Execute());

            Exception exceptionReported = exceptionThrowingAction.FakePackageManagementEvents.ExceptionPassedToOnPackageOperationError;

            Assert.AreEqual(expectedException, exceptionReported);
        }
Exemplo n.º 2
0
        public void Execute_ExceptionThrownInExecuteCore_ExceptionThrownByExecuteMethod()
        {
            CreateActionWithExceptionThrownInExecuteCore();
            var expectedException = new Exception("Error");

            exceptionThrowingAction.ExceptionToThrowInExecuteCore = expectedException;

            Exception exception = Assert.Throws <Exception> (() => exceptionThrowingAction.Execute());

            Assert.AreEqual(expectedException, exception);
        }