public void ScenarioPassesWithStep()
        {
            var scenario = new ScenarioDescription("scenario", TestHost.Step2);
            var result   = new ScenarioResult(scenario);

            result.Run(new ScenarioContext());

            Assert.IsFalse(result.Failed);
        }
        public void ExecutionSequenceByMethod()
        {
            var scenario = new ScenarioDescription("scenario1", TestHost.FailedStep, TestHost.Step2);
            var result   = new ScenarioResult(scenario);

            var testContext = new ScenarioContext();

            testContext["sequence"] = 1;
            result.Run(testContext);

            Assert.AreEqual(1, (int)testContext[nameof(TestHost.FailedStep)], scenario.Description);
            Assert.AreEqual(2, (int)testContext[nameof(TestHost.Step2)], scenario.Description);

            // change sequence and make sure that it is different this time
            scenario = new ScenarioDescription("scenario2", TestHost.Step2, TestHost.FailedStep);
            result   = new ScenarioResult(scenario);

            testContext             = new ScenarioContext();
            testContext["sequence"] = 1;
            result.Run(testContext);

            Assert.AreEqual(2, (int)testContext[nameof(TestHost.FailedStep)], scenario.Description);
            Assert.AreEqual(1, (int)testContext[nameof(TestHost.Step2)], scenario.Description);
        }
        public void ExecutionSequenceByJson()
        {
            var scenario = ScenarioDescription.FromJson("scenario1", @"[{'action':'Step2'}, {'action':'FailedStep'}]", typeof(TestHost));
            var result   = new ScenarioResult(scenario);

            var testContext = new ScenarioContext();

            testContext["sequence"] = 1;
            result.Run(testContext);

            Assert.AreEqual(2, (int)testContext[nameof(TestHost.FailedStep)], scenario.Description);
            Assert.AreEqual(1, (int)testContext[nameof(TestHost.Step2)], scenario.Description);

            // change sequence and make sure that it is different this time
            scenario = ScenarioDescription.FromJson("scenario2", @"[{'action':'FailedStep'}, {'action':'Step2'}]", typeof(TestHost));
            result   = new ScenarioResult(scenario);

            testContext             = new ScenarioContext();
            testContext["sequence"] = 1;
            result.Run(testContext);

            Assert.AreEqual(1, (int)testContext[nameof(TestHost.FailedStep)], scenario.Description);
            Assert.AreEqual(2, (int)testContext[nameof(TestHost.Step2)], scenario.Description);
        }