Esempio n. 1
0
            IEnumerable <EventReceived> CreateSecondFeature()
            {
                var feature           = new Feature("Second feature");
                var scenarioResult    = new ScenarioResult(feature, "ScenarioTitle");
                var actionStepResult1 = new StepResult(Step("Given a"), Passed);

                scenarioResult.AddActionStepResult(actionStepResult1);
                var actionStepResult2 = new StepResult(Step("When b"), Passed);

                scenarioResult.AddActionStepResult(actionStepResult2);
                var actionStepResult3 = new StepResult(Step("Then c"), Passed);

                scenarioResult.AddActionStepResult(actionStepResult3);

                var eventsReceived = new List <EventReceived>
                {
                    new EventReceived(feature.Title, EventType.FeatureStart),
                    new EventReceived("As a x\nI want y\nSo That z", EventType.FeatureNarrative),
                    new EventReceived("ScenarioTitle", EventType.ScenarioStart),
                    new ScenarioResultEventReceived(scenarioResult),
                    new EventReceived(feature.Title, EventType.FeatureFinished)
                };

                return(eventsReceived);
            }
Esempio n. 2
0
            protected override void EstablishContext()
            {
                var memStream = new MemoryStream();
                var xmlWriter = new XmlTextWriter(memStream, Encoding.UTF8);

                var feature           = new Feature("FeatureTitle");
                var scenarioResult    = new ScenarioResult(feature, "ScenarioTitle");
                var actionStepResult1 = new StepResult(Step("Given a"), Passed);

                scenarioResult.AddActionStepResult(actionStepResult1);
                var actionStepResult2 = new StepResult(Step("When b"), Passed);

                scenarioResult.AddActionStepResult(actionStepResult2);
                var actionStepResult3 = new StepResult(Step("Then c"), Passed);

                scenarioResult.AddActionStepResult(actionStepResult3);

                var eventsReceived = new List <EventReceived>
                {
                    new EventReceived("FeatureTitle", EventType.FeatureStart),
                    new EventReceived("As a x\nI want y\nSo That z", EventType.FeatureNarrative),
                    new EventReceived("ScenarioTitle", EventType.ScenarioStart),
                    new ScenarioResultEventReceived(scenarioResult)
                };

                xmlOutputWriter = new XmlOutputWriter(xmlWriter, eventsReceived);
                xmlOutputWriter.DoFeature(eventsReceived[0]);
                xmlWriter.Flush();
                xmlDoc = new XmlDocument();
                memStream.Seek(0, SeekOrigin.Begin);
                xmlDoc.Load(memStream);
            }
Esempio n. 3
0
            protected override void Because_of()
            {
                var result = new ScenarioResult(feature, ScenarioTitle);

                result.AddActionStepResult(new StepResult(new StringStep("Given something that passes", Source), new Passed()));
                result.AddActionStepResult(new StepResult(new StringStep("Given something", Source), new PendingNotImplemented("not implemented")));
                resultPublisher.Notify(result);
            }
Esempio n. 4
0
        public void HasFailedSteps_should_report_failed_if_at_least_one_step_failed()
        {
            var passed = new StepResult("Foo".AsStringStep(""), new Passed());

            _results.AddActionStepResult(passed);
            var failed = new StepResult("Foo".AsStringStep(""), new Failed(new Exception()));

            _results.AddActionStepResult(failed);
            Assert.IsTrue(_results.HasFailedSteps());
        }
Esempio n. 5
0
            protected override void Because_of()
            {
                var result = new ScenarioResult(feature, ScenarioTitle);

                result.AddActionStepResult(new StepResult(new StringStep("Given something", Source), new Failed(new ArgumentNullException("wtf!"))));
                resultPublisher.Notify(result);
            }
Esempio n. 6
0
        private void CreatePendingSteps(EventReceived evt, ScenarioResult scenarioResult)
        {
            var actionSteps = from e in EventsOf(evt, EventType.ScenarioResult)
                              where e.EventType == EventType.ScenarioStart
                              select e;

            foreach (var step in actionSteps)
            {
                scenarioResult.AddActionStepResult(new StepResult(new StringStep(step.Message, "lost it"), new Pending(scenarioResult.Message)));
            }
        }
Esempio n. 7
0
            protected override void Because_of()
            {
                var result          = new ScenarioResult(feature, ScenarioTitle);
                var stringTableStep = new StringTableStep("Given something", Source);

                stringTableStep.AddTableStep(new Example(new ExampleColumns(new[] { new ExampleColumn("A"), new ExampleColumn("B"), }),
                                                         new Dictionary <string, string> {
                    { "A", "aaa" }, { "B", "bb" }
                }));
                result.AddActionStepResult(new StepResult(stringTableStep, new Passed()));
                resultPublisher.Notify(result);
            }
Esempio n. 8
0
 public void EstablishContext()
 {
     _writer = new StringWriter();
     _output = new SummaryWriter(_writer);
     var feature = new Feature("feature title");
     var featureResult = new FeatureResult(feature.Title);
     var scenarioResult = new ScenarioResult(feature, "scenario title");
     scenarioResult.AddActionStepResult(new StepResult("a".AsStringStep(""), new Passed()));
     scenarioResult.AddActionStepResult(new StepResult("b".AsStringStep(""), new Passed()));
     scenarioResult.AddActionStepResult(new StepResult("c".AsStringStep(""), new Pending("pending reason")));
     scenarioResult.AddActionStepResult(new StepResult("c".AsStringStep(""), new PendingNotImplemented("not implemented")));
     scenarioResult.AddActionStepResult(new StepResult("d".AsStringStep(""), new Failed(new Exception("why it failed"))));
     scenarioResult.AddActionStepResult(new StepResult("c".AsStringStep(""), new Skipped("previous step failed")));
     featureResult.AddResult(scenarioResult);
     _output.WriteSummaryResults(featureResult);
 }
Esempio n. 9
0
        public void EstablishContext()
        {
            _writer = new StringWriter();
            _output = new SummaryWriter(_writer);
            var feature        = new Feature("feature title");
            var featureResult  = new FeatureResult(feature.Title);
            var scenarioResult = new ScenarioResult(feature, "scenario title");

            scenarioResult.AddActionStepResult(new StepResult("a".AsStringStep(""), new Passed()));
            scenarioResult.AddActionStepResult(new StepResult("b".AsStringStep(""), new Passed()));
            scenarioResult.AddActionStepResult(new StepResult("c".AsStringStep(""), new Pending("pending reason")));
            scenarioResult.AddActionStepResult(new StepResult("c".AsStringStep(""), new PendingNotImplemented("not implemented")));
            scenarioResult.AddActionStepResult(new StepResult("d".AsStringStep(""), new Failed(new Exception("why it failed"))));
            scenarioResult.AddActionStepResult(new StepResult("c".AsStringStep(""), new Skipped("previous step failed")));
            featureResult.AddResult(scenarioResult);
            _output.WriteSummaryResults(featureResult);
        }
Esempio n. 10
0
        protected virtual void EstablishContext()
        {
            var memStream = new MemoryStream();
            var xmlWriter = new XmlTextWriter(memStream, Encoding.UTF8);

            var story = new Feature("StoryTitle");
            var scenarioResult = new ScenarioResult(story, "ScenarioTitle");
            var actionStepResult = new StepResult(Step("Given Foo"), Passed);
            scenarioResult.AddActionStepResult(actionStepResult);

            var eventsReceived = new List<EventReceived>
                                     {
                                         new EventReceived("", EventType.RunStart),
                                         new EventReceived("StoryTitle", EventType.FeatureStart),
                                         new EventReceived("As a x\nI want y\nSo That z", EventType.FeatureNarrative),
                                         new EventReceived("ScenarioTitle", EventType.ScenarioStart),
                                         new ScenarioResultEventReceived(scenarioResult),
                                         new EventReceived("", EventType.FeatureFinished),
                                         new EventReceived("", EventType.RunFinished)
                                     };

            _xmlOutputWriter = new XmlOutputWriter(xmlWriter, eventsReceived);
        }
Esempio n. 11
0
        protected virtual void EstablishContext()
        {
            var memStream = new MemoryStream();
            var xmlWriter = new XmlTextWriter(memStream, Encoding.UTF8);

            var story            = new Feature("StoryTitle");
            var scenarioResult   = new ScenarioResult(story, "ScenarioTitle");
            var actionStepResult = new StepResult(Step("Given Foo"), Passed);

            scenarioResult.AddActionStepResult(actionStepResult);

            var eventsReceived = new List <EventReceived>
            {
                new EventReceived("", EventType.RunStart),
                new EventReceived("StoryTitle", EventType.FeatureStart),
                new EventReceived("As a x\nI want y\nSo That z", EventType.FeatureNarrative),
                new EventReceived("ScenarioTitle", EventType.ScenarioStart),
                new ScenarioResultEventReceived(scenarioResult),
                new EventReceived("", EventType.FeatureFinished),
                new EventReceived("", EventType.RunFinished)
            };

            xmlOutputWriter = new XmlOutputWriter(xmlWriter, eventsReceived);
        }
Esempio n. 12
0
 private void CreatePendingSteps(EventReceived evt, ScenarioResult scenarioResult)
 {
     var actionSteps = from e in EventsOf(evt, EventType.ScenarioResult)
                       where e.EventType == EventType.ScenarioStart
                       select e;
     foreach (var step in actionSteps)
         scenarioResult.AddActionStepResult(new StepResult(new StringStep(step.Message, "lost it"), new Pending(scenarioResult.Message)));
 }
Esempio n. 13
0
            IEnumerable<EventReceived> CreateSecondFeature()
            {
                var feature = new Feature("Second feature");
                var scenarioResult = new ScenarioResult(feature, "ScenarioTitle");
                var actionStepResult1 = new StepResult(Step("Given a"), Passed);
                scenarioResult.AddActionStepResult(actionStepResult1);
                var actionStepResult2 = new StepResult(Step("When b"), Passed);
                scenarioResult.AddActionStepResult(actionStepResult2);
                var actionStepResult3 = new StepResult(Step("Then c"), Passed);
                scenarioResult.AddActionStepResult(actionStepResult3);

                var eventsReceived = new List<EventReceived>
                                         {
                                             new EventReceived(feature.Title, EventType.FeatureStart),
                                             new EventReceived("As a x\nI want y\nSo That z", EventType.FeatureNarrative),
                                             new EventReceived("ScenarioTitle", EventType.ScenarioStart),
                                             new ScenarioResultEventReceived(scenarioResult),
                                             new EventReceived(feature.Title, EventType.FeatureFinished)
                                         };
                return eventsReceived;
            }
Esempio n. 14
0
            protected override void EstablishContext()
            {
                var memStream = new MemoryStream();
                var xmlWriter = new XmlTextWriter(memStream, Encoding.UTF8);

                var feature = new Feature("FeatureTitle");
                var scenarioResult = new ScenarioResult(feature, "ScenarioTitle");
                var actionStepResult1 = new StepResult(Step("Given a"), Passed);
                scenarioResult.AddActionStepResult(actionStepResult1);
                var actionStepResult2 = new StepResult(Step("When b"), Passed);
                scenarioResult.AddActionStepResult(actionStepResult2);
                var actionStepResult3 = new StepResult(Step("Then c"), Passed);
                scenarioResult.AddActionStepResult(actionStepResult3);

                var eventsReceived = new List<EventReceived>
                                         {
                                             new EventReceived("ScenarioTitle", EventType.ScenarioStart),
                                             new ScenarioResultEventReceived(scenarioResult)
                                         };

                _xmlOutputWriter = new XmlOutputWriter(xmlWriter, eventsReceived);
                _xmlOutputWriter.DoScenario(eventsReceived[0], scenarioResult);
                xmlWriter.Flush();
                _xmlDoc = new XmlDocument();
                memStream.Seek(0, SeekOrigin.Begin);
                _xmlDoc.Load(memStream);
            }