Example #1
0
        public static void AddScenario(BDDScenarioCmdletBase cmdlet)
        {
            ScenarioProcessingClass scenarioClass =
                BDDAddinData.GetFeature(
                    cmdlet.InputObject.Title,
                    cmdlet.InputObject.Narrative);

            if (null != scenarioClass) {
                scenarioClass.AddScenario(cmdlet);
            }
        }
        public NBehave.Narrator.Framework.Scenario AddScenario(
           BDDScenarioCmdletBase cmdlet)
        {
            IScenarioBuilderStartWithHelperObject scenarioObject =
                Feature.AddScenario();

            IGivenFragment fragmentGiven = null;
            if (null != cmdlet.Given && 0 < cmdlet.Given.Length) {
                int counterGiven = 0;
                foreach (string stepNameGiven in cmdlet.Given) {

                    if (0 == counterGiven) {
                        fragmentGiven =
                            scenarioObject.Given(stepNameGiven);
                    } else {
                        fragmentGiven =
                            fragmentGiven.And(stepNameGiven);
                    }
                    counterGiven++;
                }
            }

            fragmentGiven.And("aaaaaaaaaaaaaaaaaaaaaaaaa");

            IWhenFragment fragmentWhen = null;
            if (null != cmdlet.When && 0 < cmdlet.When.Length) {
                int counterWhen = 0;
                foreach (string stepNameWhen in cmdlet.When) {

                    if (0 == counterWhen) {
                        fragmentWhen =
                            fragmentGiven.When(stepNameWhen);
                    } else {
                        fragmentWhen =
                            fragmentWhen.And(stepNameWhen);
                    }
                    counterWhen++;
                }
            }

            fragmentWhen.And("bbbbbbbbbbbbbbbbbbbbbbbbb");

            IThenFragment fragmentThen = null;
            if (null != cmdlet.Then && 0 < cmdlet.Then.Length) {
                int counterThen = 0;
                foreach (string stepNameThen in cmdlet.Then) {

                    if (0 == counterThen) {
                        fragmentThen =
                            fragmentWhen.Then(stepNameThen);
                    } else {
                        fragmentThen =
                            fragmentThen.And(stepNameThen);
                    }
                    counterThen++;
                }
            }

            fragmentThen.And("cccccccccccccccccccccccccccc");

            return Feature.Scenarios[Feature.Scenarios.Count - 1];
        }