コード例 #1
0
        public void CodeBehindGeneratorCreatesScenarioWithSteps()
        {
            var features = TestCodeBehindData.FeatureWithScenarioAndNoStep();

            features[0].Scenarios[0].Steps.Add(new NodeStep("GivenIHaveAStep"));
            features[0].Scenarios[0].Steps.Add(new NodeStep("WhenIHaveAStep"));
            features[0].Scenarios[0].Steps.Add(new NodeStep("ThenIHaveAStep"));

            var files = GeneratorFactory.Generate(GeneratorType.CodeBehindGenerator, features);

            string parameterName = string.Empty;

            string[] stringsExpected = new string[] {
                string.Format("#include \"{0}.h\"", features[0].Name),
                string.Empty,
                "namespace CppUnitTest",
                "{",
                string.Format("\tvoid {0}::{1}()", features[0].Name, features[0].Scenarios[0].Name),
                "\t{",
                string.Format("\t\t{0}({1});", features[0].Scenarios[0].Steps[0].Name, parameterName),
                string.Format("\t\t{0}({1});", features[0].Scenarios[0].Steps[1].Name, parameterName),
                string.Format("\t\t{0}({1});", features[0].Scenarios[0].Steps[2].Name, parameterName),
                "\t}",
                "}"
            };

            AssertExt.ContentsOfStringArray(stringsExpected, files[0]);
        }
コード例 #2
0
        public void CodeBehindGeneratorCreatesScenarioWithNoSteps()
        {
            var features = TestCodeBehindData.FeatureWithScenarioAndNoStep();
            var files    = GeneratorFactory.Generate(GeneratorType.CodeBehindGenerator, features);

            string[] stringsExpected = new string[] {
                string.Format("#include \"{0}.h\"", features[0].Name),
                string.Empty,
                "namespace CppUnitTest",
                "{",
                string.Format("\tvoid {0}::{1}()", features[0].Name, features[0].Scenarios[0].Name),
                "\t{",
                "\t}",
                "}"
            };

            AssertExt.ContentsOfStringArray(stringsExpected, files[0]);
        }