Exemple #1
0
        public void TestUnexpectedErrorInnerExceptionTest()
        {
            Exception innerException           = new Exception("Inner exception");
            UnexpectedErrorException exception = new UnexpectedErrorException("UnexpectedError Exception Messsage", innerException);

            Assert.AreEqual(exception.Message, "UnexpectedError Exception Messsage");
            Assert.AreEqual(exception.InnerException, innerException);
        }
        private void StartStateMachine()
        {
            if (this.states.Count == 0)
            {
                UnexpectedErrorException ex = new UnexpectedErrorException("No states to run state machine!");
                Tracer <BaseStateMachine> .WriteError(ex);

                throw ex;
            }
            this.machineState           = BaseStateMachine.StateMachineState.Running;
            this.CurrentState           = this.states[0];
            this.CurrentState.Finished += new EventHandler <TransitionEventArgs>(this.CurrentStateFinished);
            this.CurrentState.Errored  += new EventHandler <Error>(this.CurrentStateErrored);
            this.CurrentState.Start();
        }
Exemple #3
0
        private static ProblemDetails RetrieveUnexpected(Exception exception)
        {
            Log.ForContext("Type", "Error").ForContext("Exception", exception, destructureObjects: true)
            .Error(exception, exception.Message + ". {@errorId}", _responseKey);

            var unexpectedError = new UnexpectedErrorException(exception);

            return(new ProblemDetails
            {
                Title = unexpectedError.ExposedTitle,
                Type = ErrorCodeEnum.Unexpected.GetErrorType(),
                Status = (int)unexpectedError.StatusCode,
                Detail = unexpectedError.ExposedDetails,
                Instance = $"errorId:{_responseKey}"
            });
        }
Exemple #4
0
        public void TestUnexpectedErrorMessageTest()
        {
            UnexpectedErrorException exception = new UnexpectedErrorException("UnexpectedError Exception Messsage");

            Assert.AreEqual(exception.Message, "UnexpectedError Exception Messsage");
        }
Exemple #5
0
        public void TestUnexpectedErrorDefaultTest()
        {
            UnexpectedErrorException exception = new UnexpectedErrorException();

            Assert.AreEqual(exception.Message, "Exception of type 'WebTestSuite.Exceptions.UnexpectedErrorException' was thrown.");
        }
		private void StartStateMachine()
		{
			if (this.states.Count == 0)
			{
				UnexpectedErrorException ex = new UnexpectedErrorException("No states to run state machine!");
				Tracer<BaseStateMachine>.WriteError(ex);
				throw ex;
			}
			this.machineState = BaseStateMachine.StateMachineState.Running;
			this.CurrentState = this.states[0];
			this.CurrentState.Finished += new EventHandler<TransitionEventArgs>(this.CurrentStateFinished);
			this.CurrentState.Errored += new EventHandler<Error>(this.CurrentStateErrored);
			this.CurrentState.Start();
		}