Beispiel #1
0
            private void BecauseOf()
            {
                var actionText = new StringStep("Given", "abc def", "somestory.story");
                var action     = _actionCatalog.GetAction(actionText);

                (action.Action as Action).Invoke();
            }
Beispiel #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);
            }
Beispiel #3
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);
            }
        public Action ResolveStep(StringStep stringStep)
        {
            var actionMethodInfo = _actionCatalog.GetAction(stringStep);

            if (actionMethodInfo == null)
            {
                return(null);
            }

            var parameters = _parameterConverter.GetParametersForStep(stringStep);

            return(() =>
            {
                actionMethodInfo.ExecuteNotificationMethod(typeof(BeforeStepAttribute));
                actionMethodInfo.MethodInfo.Invoke(_stepHelper, parameters);
                actionMethodInfo.ExecuteNotificationMethod(typeof(AfterStepAttribute));
            });
        }
Beispiel #5
0
            private void BecauseOf()
            {
                var actionText = new StringStep("Given", "foo and bar", "somestory.story");

                _action = _actionCatalog.GetAction(actionText);
            }