Exemplo n.º 1
0
        protected State ProcessInputChar(char nextChar)
        {
            if (nextChar == '\n')
            {
                _lineCounter++;
                _charCounter = 0;
            }
            else if (nextChar != '\r')
            {
                _charCounter++;
            }

            if (IsSkip(nextChar))
            {
                return(State.Ignore);
            }

            State result = _parser.AddSymbol(nextChar);

            switch (result)
            {
            case State.Ignore:
                OnIgnore?.Invoke(this, _charCounter, nextChar);
                break;

            case State.Accept:
                OnAccept?.Invoke(this, _charCounter, nextChar);
                break;

            case State.Incorrect:
                OnIncorrect?.Invoke(this, _lineCounter, _charCounter, nextChar);
                break;

            case State.VeryBigDigit:
                OnVeryBigDigit?.Invoke(this, _lineCounter);
                break;

            case State.PairDone:
                OnNewPair?.Invoke(this, _parser.ReceivedCoordinates.Last());
                break;

            default:
                break;
            }

            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Invokes the proper status event based on the execution context's result status
        /// </summary>
        /// <param name="executionContext"></param>
        protected void InvokeStatusEvent(ExecutionContext executionContext)
        {
            switch (executionContext.Result.Status)
            {
            case TestStatus.Pass:
                OnPass.Invoke(executionContext);
                break;

            case TestStatus.Fail:
                OnFail.Invoke(executionContext);
                break;

            case TestStatus.Error:
                OnError.Invoke(executionContext);
                break;

            case TestStatus.Ignore:
                OnIgnore.Invoke(executionContext);
                break;
            }
        }