public override void visit(Generated.Expectation obj, bool subNodes)
        {
            Tests.Expectation expect = obj as Tests.Expectation;

            if (expect != null)
            {
                try
                {
                    expect.Messages.Clear();
                    if (!expect.Expression.Contains("%"))
                    {
                        Interpreter.Expression expression = checkExpression(expect, expect.Expression);
                        if (!expect.EFSSystem.BoolType.Match(expression.GetExpressionType()))
                        {
                            expect.AddError("Expression type should be Boolean");
                        }
                    }
                    if (expect.getCondition() != null && !expect.getCondition().Contains("%"))
                    {
                        Interpreter.Expression expression = checkExpression(expect, expect.getCondition());
                        if (!expect.EFSSystem.BoolType.Match(expression.GetExpressionType()))
                        {
                            expect.AddError("Condition type should be Boolean");
                        }
                    }
                }
                catch (Exception exception)
                {
                    expect.AddException(exception);
                }
            }

            base.visit(obj, subNodes);
        }
        public override Expectation createExpectation()
        {
            Expectation retVal = new Tests.Expectation();

            _defaultValueSetter.SetDefaultValue(retVal);

            return(retVal);
        }
Exemple #3
0
        /// <summary>
        /// Provides the corresponding expectation, if any
        /// </summary>
        /// <returns></returns>
        private DataDictionary.Tests.Expectation getExpectation()
        {
            DataDictionary.Tests.Expectation retVal = null;


            ExpectationStateChange expectationChange = ModelEvent as ExpectationStateChange;

            if (expectationChange != null)
            {
                retVal = expectationChange.Expect.Expectation;
            }
            Expect expect = ModelEvent as Expect;

            if (expect != null)
            {
                retVal = expect.Expectation;
            }

            return(retVal);
        }
        public override Expectation createExpectation()
        {
            Expectation retVal = new Tests.Expectation();

            _defaultValueSetter.SetDefaultValue(retVal);

            return retVal;
        }
Exemple #5
0
        /// <summary>
        /// Click!
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EventControl_Click(object sender, EventArgs e)
        {
            if (ModelEvent is RuleFired)
            {
                if (TimeLine.Window.MDIWindow.DataDictionaryWindow != null)
                {
                    RuleFired ruleFired = ModelEvent as RuleFired;
                    TimeLine.Window.MDIWindow.DataDictionaryWindow.TreeView.Select(ruleFired.RuleCondition);
                }
            }
            else if (ModelEvent is VariableUpdate)
            {
                VariableUpdate variableUpdate = ModelEvent as VariableUpdate;

                if (isDoubleClick())
                {
                    if (variableUpdate != null)
                    {
                        DataDictionary.Interpreter.ExplanationPart explain = variableUpdate.Explanation;
                        ExplainBox explainTextBox = new ExplainBox();
                        explainTextBox.setExplanation(explain);
                        MDIWindow.AddChildWindow(explainTextBox);
                    }
                }

                BaseTreeNode treeNode = null;

                if (TimeLine.Window.MDIWindow.DataDictionaryWindow != null)
                {
                    treeNode = TimeLine.Window.MDIWindow.DataDictionaryWindow.TreeView.Select(variableUpdate.Action);
                }
                if (treeNode == null)
                {
                    if (TimeLine.Window.MDIWindow.TestWindow != null)
                    {
                        TimeLine.Window.MDIWindow.TestWindow.TreeView.Select(variableUpdate.Action);
                    }
                }
            }
            else if (ModelEvent is Expect)
            {
                if (isDoubleClick())
                {
                    DataDictionary.Tests.Expectation expectation = getExpectation();

                    if (expectation != null)
                    {
                        DataDictionary.Interpreter.ExplanationPart explain = expectation.ExpressionTree.Explain();
                        ExplainBox explainTextBox = new ExplainBox();
                        explainTextBox.setExplanation(explain);
                        MDIWindow.AddChildWindow(explainTextBox);
                    }
                }

                if (TimeLine.Window.MDIWindow.TestWindow != null)
                {
                    TimeLine.Window.MDIWindow.TestWindow.TreeView.Select((ModelEvent as Expect).Expectation);
                }
            }

            lastClick = DateTime.Now;
        }
        private void fillBrakingParametersExpectations(TestCase aTestCase, int stepNumber, string name, string expression, List<double> distanceValues, List<double> speedValues, List<double> values)
        {
            Step aStep = new Step();
            aStep.Name = String.Format("Step{0} - {1}", stepNumber, name);
            aTestCase.AddModelElement(aStep);

            SubStep aSubStep = new SubStep();
            aSubStep.Name = String.Format("SubStep1 - Verify {0} values", name);
            aStep.AddModelElement(aSubStep);

            for (int i = 0; i < values.Count; i++)
            {
                if (values[i] != -1)
                {
                    Expectation expectation = new Expectation();
                    expectation.Expression = String.Format(CultureInfo.InvariantCulture, expression, Math.Round(distanceValues[i], 2), Math.Round(speedValues[i], 2), Math.Round(values[i], 4));
                    aSubStep.AddModelElement(expectation);
                }
            }
        }
 private void addExpectation(SubStep aSubStep, string expression)
 {
     Expectation anExpectation = new Expectation();
     anExpectation.Expression = expression;
     anExpectation.Blocking = true;
     aSubStep.AddModelElement(anExpectation);
 }