Ejemplo n.º 1
0
        public object[] GetParametersForStep(StringStep stringStep)
        {
            var action = _actionCatalog.GetAction(stringStep);

            object[] parametersForStep;
            if (IsListStep(action, stringStep))
            {
                parametersForStep = GetParametersForListStep(action, stringStep);
            }
            else
            {
                parametersForStep = GetParametersForStep(stringStep, action);
            }
            AddDocStringParameter(parametersForStep, stringStep);
            return(parametersForStep);
        }
Ejemplo n.º 2
0
            public void ShouldGetAction()
            {
                var catalog = new ActionCatalog();

                var action = new ActionMethodInfo(
                    "my savings account balance is $balance".AsRegex(),
                    new object(),
                    GetDummyParameterInfo(),
                    null);

                catalog.Add(action);

                var actionResult = catalog.GetAction(new StringStep("Given my savings account balance is 500", ""));

                Assert.That(actionResult, Is.Not.Null);
            }
Ejemplo n.º 3
0
        private void RunStep(StringStep actionStep)
        {
            var info = ActionCatalog.GetAction(actionStep);

            try
            {
                //TODO: Move Before-/After-EachStep to RunContext !!
                BeforeEachScenario(info);
                BeforeEachStep(info);
                if (actionStep is StringTableStep && !ShouldForEachOverStep(info))
                {
                    ForEachOverStep(actionStep as StringTableStep, info);
                }
                else
                {
                    RunStep(info, () => ParameterConverter.GetParametersForStep(actionStep));
                }
            }
            finally
            {
                lastAction = info;
                AfterEachStep(info);
            }
        }
Ejemplo n.º 4
0
            public void ShouldGetActionWithTokenInMiddleOfString()
            {
                var catalog = new ActionCatalog();
                Action<int> action = accountBalance => { };

                var actionMethodInfo = new ActionMethodInfo(
                    "I have $amount euros on my cash account".AsRegex(),
                    action,
                    action.Method,
                    null);

                catalog.Add(actionMethodInfo);

                var actionFetched = catalog.GetAction(new StringStep("Given I have 20 euros on my cash account", ""));

                Assert.That(actionFetched, Is.Not.Null);
            }