示例#1
0
        public StepthroughExecutor(IExecutionContext execution, SpecExecutionRequest request, IUserInterfaceObserver observer)
        {
            _context = new SpecContext(request.Specification, new Timings(), request.Observer, new StopConditions(), execution);

            _execution = execution;
            _request   = request;
            _observer  = observer;
            var gatherer = new ExecutionStepGatherer(_context);

            _request.Plan.AcceptVisitor(gatherer);

            _steps = gatherer.Lines;


            try
            {
                _execution.BeforeExecution(_context);
            }
            catch (Exception e)
            {
                _context.LogException(_request.Id, e, "BeforeExecution");
            }

            _observer.SendProgress(new SpecProgress(_request.Id, _context.Counts, 0, _steps.Count));
            sendNextStepMessage();
        }
        public StepthroughExecutor(IExecutionContext execution, SpecExecutionRequest request, IUserInterfaceObserver observer)
        {
            _context = new SpecContext(request.Specification, new Timings(), request.Observer, new StopConditions(), execution);

            _execution = execution;
            _request = request;
            _observer = observer;
            var gatherer = new ExecutionStepGatherer(_context);
            _request.Plan.AcceptVisitor(gatherer);

            _steps = gatherer.Lines;


            try
            {
                _execution.BeforeExecution(_context);
            }
            catch (Exception e)
            {
                _context.LogException(_request.Id, e, "BeforeExecution");
            }

            _observer.SendProgress(new SpecProgress(_request.Id, _context.Counts, 0, _steps.Count));
            sendNextStepMessage();
        }
        public void can_gather_up_the_lines()
        {
            var gatherer = new ExecutionStepGatherer(Executor.Context);
            var plan = Specification.CreatePlan(TestingContext.Library);
            plan.AcceptVisitor(gatherer);

            gatherer.Lines.Count.ShouldBe(7);

            gatherer.Lines[0].ShouldBeOfType<SilentAction>();

            gatherer.Lines[1].ShouldBeOfType<LineStep>();
            gatherer.Lines[2].ShouldBeOfType<LineStep>();
            gatherer.Lines[3].ShouldBeOfType<LineStep>();
            gatherer.Lines[4].ShouldBeOfType<LineStep>();
            gatherer.Lines[5].ShouldBeOfType<LineStep>();

            gatherer.Lines.Last().ShouldBeOfType<SilentAction>();
        }