private void Init() { NBehaveInitializer.Initialize(ConfigurationNoAppDomain.New.SetEventListener(Framework.EventListeners.EventListeners.NullEventListener())); actionCatalog = TinyIoCContainer.Current.Resolve<ActionCatalog>(); stringStepRunner = new StringStepRunner(actionCatalog); runner = new FeatureRunner(stringStepRunner, TinyIoCContainer.Current.Resolve<IRunContext>()); }
public FeatureResults Run() { NBehaveInitializer.Initialize(configuration); actionCatalog = TinyIoCContainer.Current.Resolve <ActionCatalog>(); var featureRunner = TinyIoCContainer.Current.Resolve <IFeatureRunner>(); var context = TinyIoCContainer.Current.Resolve <IRunContext>(); var results = new FeatureResults(); try { context.RunStarted(); LoadAssemblies(); var loader = new LoadScenarioFiles(configuration); var files = loader.LoadFiles(); var parse = new ParseScenarioFiles(configuration); var features = parse.LoadFiles(files); results = Run(featureRunner, features, context); } finally { context.RunFinished(results); } return(results); }
public ActionStepStepResolver(object stepHelper) { _stepHelper = stepHelper; _actionCatalog = new ActionCatalog(); _stepParser = new ActionStepParser(new StoryRunnerFilter(), _actionCatalog); _stepParser.FindActionStepMethods(stepHelper.GetType(), _stepHelper); _parameterConverter = new ParameterConverter(_actionCatalog); }
private void CreateActionCatalog() { actionCatalog = new ActionCatalog(); Action<string> given = x => { }; actionCatalog.Add(new ActionMethodInfo("name $x".AsRegex(), given, given.Method, "Given")); Action when = () => { }; actionCatalog.Add(new ActionMethodInfo("greeted".AsRegex(), when, when.Method, "When")); Action<string> then = y => Assert.AreEqual("Nisse", y); actionCatalog.Add(new ActionMethodInfo("Hello $y".AsRegex(), then, then.Method, "Then")); }
public void ShouldConsiderThe2ActionsAsEqual() { var catalog = new ActionCatalog(); var action = new ActionMethodInfo( "my savings account balance is $balance".AsRegex(), new object(), GetDummyParameterInfo(), null); catalog.Add(action); var actionExists = catalog.ActionExists("Given my savings account balance is 500".AsStringStep("")); Assert.That(actionExists, Is.True); }
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); }
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 void Run(StringStep step) { try { if (!ActionCatalog.ActionExists(step)) { var pendReason = string.Format("No matching Action found for \"{0}\"", step); step.PendNotImplemented(pendReason); } else { RunStep(step); } } catch (Exception e) { var realException = FindUsefulException(e); step.Fail(realException); } }
public FeatureResults Run() { NBehaveInitializer.Initialize(configuration); actionCatalog = TinyIoCContainer.Current.Resolve<ActionCatalog>(); var featureRunner = TinyIoCContainer.Current.Resolve<IFeatureRunner>(); var context = TinyIoCContainer.Current.Resolve<IRunContext>(); var results = new FeatureResults(); try { context.RunStarted(); LoadAssemblies(); var loader = new LoadScenarioFiles(configuration); var files = loader.LoadFiles(); var parse = new ParseScenarioFiles(configuration); var features = parse.LoadFiles(files); results = Run(featureRunner, features, context); } finally { context.RunFinished(results); } return results; }
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); } }
public StringStepRunner(ActionCatalog actionCatalog) { ActionCatalog = actionCatalog; ParameterConverter = new ParameterConverter(ActionCatalog); }
public ParameterConverter(ActionCatalog actionCatalog) { _actionCatalog = actionCatalog; }
public virtual void Setup() { actionCatalog = new ActionCatalog(); runner = new StringStepRunner(actionCatalog); }
public ParameterConverter(ActionCatalog actionCatalog) { _actionCatalog = actionCatalog; }
public StringStepRunner(ActionCatalog actionCatalog) { ActionCatalog = actionCatalog; ParameterConverter = new ParameterConverter(ActionCatalog); }
public ActionStepParser(StoryRunnerFilter storyRunnerFilter, ActionCatalog actionCatalog) { this.storyRunnerFilter = storyRunnerFilter; this.actionCatalog = actionCatalog; methodWithAttributeFinder = new MethodWithAttributeFinder(storyRunnerFilter); }
public void EstablishContext() { _wasCalled = false; _actionCatalog = new ActionCatalog(); Action firstAction = () => Assert.Fail("This action shouldnt be called"); var actionMethod = new ActionMethodInfo(new Regex("def$"), firstAction, firstAction.Method, "Given", this); _actionCatalog.Add(actionMethod); Action secondAction = () => { _wasCalled = true; }; var secondActionMethod = new ActionMethodInfo(new Regex("abc def$"), secondAction, secondAction.Method, "Given", this); _actionCatalog.Add(secondActionMethod); }
public void EstablishContext() { _actionCatalog = new ActionCatalog(); Action<string, string> firstAction = (a, b) => { }; var stepMatcher = "$a and $b".AsRegex(); var actionMethod = new ActionMethodInfo(stepMatcher, firstAction, firstAction.Method, "Given", this); _actionCatalog.Add(actionMethod); Action<FooBar> secondAction = _ => { }; var secondActionMethod = new ActionMethodInfo(stepMatcher, secondAction, secondAction.Method, "Given", this); _actionCatalog.Add(secondActionMethod); Action<List<FooBar>> thirdAction = _ => { }; var thirdActionMethod = new ActionMethodInfo(stepMatcher, thirdAction, thirdAction.Method, "Given", this); _actionCatalog.Add(thirdActionMethod); }
public ActionStepParser(StoryRunnerFilter storyRunnerFilter, ActionCatalog actionCatalog) { this.storyRunnerFilter = storyRunnerFilter; this.actionCatalog = actionCatalog; methodWithAttributeFinder = new MethodWithAttributeFinder(storyRunnerFilter); }
public virtual void SetUp() { _actionCatalog = new ActionCatalog(); _actionStepParser = new ActionStepParser(_storyRunnerFilter, _actionCatalog); _actionStepParser.FindActionSteps(GetType().Assembly); }