Exemplo n.º 1
0
        void ValidateText(string text)
        {
            if (!HasError)
            {
                _originalToolTip = ToolTip;
            }
            var error = IntellisenseStringProvider.parseLanguageExpressionAndValidate(text);

            if (FilterType != enIntellisensePartType.JsonObject)
            {
                HandleNonJsonFilterType(error);
            }
            else
            {
                if (error.Item2 != string.Empty)
                {
                    ToolTip  = error.Item2;
                    HasError = true;
                }
                else
                {
                    ToolTip  = _originalToolTip;
                    HasError = false;
                }
            }
        }
Exemplo n.º 2
0
        public void ThenTheResultHasTheError(string errorMessage)
        {
            var inputText = ScenarioContext.Current.Get <string>("inputText");
            var error     = IntellisenseStringProvider.parseLanguageExpressionAndValidate(inputText);

            Assert.AreEqual(errorMessage.TrimEnd(' '), error.Item2.TrimEnd(' '));
        }
        private void ValidateText(string text)
        {
            if (!HasError)
            {
                _originalToolTip = ToolTip;
            }
            var error = IntellisenseStringProvider.parseLanguageExpressionAndValidate(text);

            if (FilterType != enIntellisensePartType.JsonObject)
            {
                if (FilterType == enIntellisensePartType.RecordsetsOnly && !error.Item1.IsRecordSetNameExpression)
                {
                    ToolTip  = error.Item2 != string.Empty ? error.Item2 : "Invalid recordset";
                    HasError = true;
                }
                else if (FilterType == enIntellisensePartType.ScalarsOnly && !error.Item1.IsScalarExpression)
                {
                    ToolTip  = error.Item2 != string.Empty ? error.Item2 : "Invalid scalar";
                    HasError = true;
                }
                else if (FilterType == enIntellisensePartType.RecordsetFields && !error.Item1.IsRecordSetExpression)
                {
                    ToolTip  = error.Item2 != string.Empty ? error.Item2 : "Invalid recordset name";
                    HasError = true;
                }
                else
                {
                    if (error.Item2 != string.Empty)
                    {
                        ToolTip  = error.Item2;
                        HasError = true;
                    }
                    else
                    {
                        ToolTip  = _originalToolTip;
                        HasError = false;
                    }
                }
            }
            else
            {
                if (error.Item2 != string.Empty)
                {
                    ToolTip  = error.Item2;
                    HasError = true;
                }
                else
                {
                    ToolTip  = _originalToolTip;
                    HasError = false;
                }
            }
        }