示例#1
0
 public StubGenerator(ScenarioInterpreter scenarioInterpreter, ImplementationHelper implementationHelper, ITextWriter suggestionWriter, ISessionContext context)
 {
     _scenarioInterpreter  = scenarioInterpreter;
     SuggestionWriter      = suggestionWriter;
     _context              = context;
     _implementationHelper = implementationHelper;
 }
示例#2
0
        public ScenarioLineExecuter(ScenarioInterpreter scenarioInterpreter,
                                    IEventBus eventBus)
        {
            _memberInvoker = new MemberInvoker();

            _scenarioInterpreter = scenarioInterpreter;
            _eventBus            = eventBus;
        }
示例#3
0
 public InPlaceStoryRunner(ScenarioInterpreter scenarioInterpreter,
                           IStoryFilter filter,
                           ISessionContext context,
                           IEventBus eventBus)
     : base(filter, context, eventBus)
 {
     _scenarioRunner = new InPlaceScenarioRunner(eventBus, scenarioInterpreter);
 }
示例#4
0
        public void SetupContext()
        {
            FakeEventBus = MockRepository.GenerateStub <IEventBus>();

            var scenarioInterpreter = new ScenarioInterpreter(new InterpreterForTypeFactory(new AssemblyRegistry()), MockRepository.GenerateStub <IAmbiguousMatchResolver>(), new DefaultLanguageService());
            var inPlaceRunner       = new InPlaceStoryRunner(scenarioInterpreter, new IncludeAllFilter(), new SessionContext(), FakeEventBus);

            inPlaceRunner.Finished();
        }
示例#5
0
        private InPlaceStoryRunner GetRunner()
        {
            FakeEventBus = new CapturingEventBus();
            var assemblyRegistry    = new AssemblyRegistry(new[] { typeof(TestExtensionMethods).Assembly });
            var scenarioInterpreter = new ScenarioInterpreter(new InterpreterForTypeFactory(assemblyRegistry), MockRepository.GenerateStub <IAmbiguousMatchResolver>(), new DefaultLanguageService());

            return(new InPlaceStoryRunner(scenarioInterpreter,
                                          new IncludeAllFilter(), new FakeSessionContext(Context), FakeEventBus));
        }
示例#6
0
        protected DriverBase(IEventBus eventBus)
        {
            //ResultListener = resultListener;
            _eventBus = eventBus;
            var assemblyRegistry = new AssemblyRegistry(GetAssemblies());

            ScenarioInterpreter = new ScenarioInterpreter(new InterpreterForTypeFactory(assemblyRegistry), new MostRecentlyUsedContext(), new DefaultLanguageService());
            LineExecuter        = new ScenarioLineExecuter(ScenarioInterpreter, _eventBus);
            _context            = new SessionContext(assemblyRegistry);
            ParameterConverter.AddCustomConverters(assemblyRegistry);
        }
示例#7
0
        public void SetupContext()
        {
            FakeResolver = MockRepository.GenerateMock <IAmbiguousMatchResolver>();

            var factory = new InterpreterForTypeFactory(new AssemblyRegistry());

            ChainReturnedFromResolver = new InvocationChain();
            FakeResolver.Stub(x => x.ResolveMatch("", null)).IgnoreArguments().Return(ChainReturnedFromResolver);

            ScenarioInterpreter interpreter = new ScenarioInterpreter(factory, FakeResolver, new DefaultLanguageService());

            Result = interpreter.GetChain(
                new ScenarioContext(new StoryContext(new FakeSessionContext()), new Type[] { typeof(AmbiguousTestClass) },
                                    new Dictionary <Type, object>()),
                "Foo bar baz");
        }
        public void SetupContext()
        {
            FakeResolver = MockRepository.GenerateMock<IAmbiguousMatchResolver>();

            var factory = new InterpreterForTypeFactory(new AssemblyRegistry());

            ChainReturnedFromResolver = new InvocationChain();
            FakeResolver.Stub(x => x.ResolveMatch("", null)).IgnoreArguments().Return(ChainReturnedFromResolver);

            ScenarioInterpreter interpreter = new ScenarioInterpreter(factory, FakeResolver, new DefaultLanguageService());

            Result = interpreter.GetChain(
                new ScenarioContext(new StoryContext(new FakeSessionContext()), new Type[] {typeof (AmbiguousTestClass)},
                                    new Dictionary<Type, object>()),
                "Foo bar baz");
        }
示例#9
0
        public void SetupContext()
        {
            FakeWriter   = MockRepository.GenerateMock <ITextWriter>();
            FakeResolver = MockRepository.GenerateMock <IAmbiguousMatchResolver>();

            var scenarioInterpreter = new ScenarioInterpreter(new InterpreterForTypeFactory(new AssemblyRegistry()), FakeResolver, new DefaultLanguageService());

            Generator =
                new StubGenerator(scenarioInterpreter,
                                  new ImplementationHelper(), FakeWriter, new FakeSessionContext());

            TestStory = new Story("foo", "", new[]
            {
                TestHelper.BuildScenario("", new[] { "first line", "second line" }),
                TestHelper.BuildScenario("", new[] { "first line", "second line", "third line" }),
                TestHelper.BuildScenario("", new[] { "this line's weird, punctuation! should be: handled" })
            });

            Generator.HandleStories(new[] { TestStory });

            Suggestions = (string)FakeWriter.GetArgumentsForCallsMadeOn(x => x.Write(Arg <string> .Is.Anything))[0][0];
        }
示例#10
0
 public InPlaceScenarioRunner(IEventBus eventBus, ScenarioInterpreter scenarioInterpreter)
 {
     _eventBus            = eventBus;
     _scenarioInterpreter = scenarioInterpreter;
     _lineExecuter        = new ScenarioLineExecuter(scenarioInterpreter, eventBus);
 }