Esempio n. 1
0
        public void Comment_should_ignore_empty_comments(string comment)
        {
            var runner = new TestableBDDRunner(GetType(), MockRepository.GenerateMock <IProgressNotifier>());

            runner.RunScenario(_ => Commented_step(comment));
            Assert.That(runner.Result.Scenarios.Single().Steps.Single().Comments.ToArray(), Is.Empty);
        }
Esempio n. 2
0
        public void Comment_should_record_comment_in_currently_executed_step()
        {
            var runner  = new TestableBDDRunner(GetType(), MockRepository.GenerateMock <IProgressNotifier>());
            var comment = "abc";

            runner.RunScenario(_ => Commented_step(comment));
            Assert.That(runner.Result.Scenarios.Single().Steps.Single().Comments.ToArray(), Is.EqualTo(new[] { comment }));
        }
        public void Running_scenarios_should_be_thread_safe()
        {
            var subject = new TestableBDDRunner(GetType(), new NoNotifier());

            Enumerable.Range(0, _elementsCount)
            .Select(i => ToScenarioBuilder(subject, i))
            .ToArray()
            .AsParallel()
            .ForAll(b => b.Run(Step_with_comments));

            Assert.That(subject.Result.Scenarios.Count(), Is.EqualTo(_elementsCount));
            for (int i = 0; i < _elementsCount; ++i)
            {
                var expectedName = ToName(i);
                var scenario     = subject.Result.Scenarios.FirstOrDefault(s => s.Name == expectedName);
                Assert.That(scenario, Is.Not.Null, "Missing scenario: {0}", i);

                var step = scenario.Steps.FirstOrDefault();
                Assert.That(step, Is.Not.Null, "Missing step for scenario: {0}", i);
                Assert.That(step.Comments.ToArray(), Is.EqualTo(new[] { "comment one", "comment 2" }), "missing comments for scenario: {0}", i);
            }
        }
 private static ICustomizedScenarioBuilder ToScenarioBuilder(TestableBDDRunner runner, int i)
 {
     return(runner.NewScenario(ToName(i)));
 }