public void CodeBehindGeneratorCreatesStepWithOneNumberParameter() { var features = TestCodeBehindData.FeatureWithScenarioAndStepAndParameter("int"); string parameterName = string.Empty; 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{", string.Format("\t\t{0}({1});", features[0].Scenarios[0].Steps[0].Name, features[0].Scenarios[0].Steps[0].Parameters[0].Value), "\t}", "}" }; AssertExt.ContentsOfStringArray(stringsExpected, files[0]); }
public void CodeBehindGeneratorCreatesScenarioWithStepsAndParametersAndTable() { var features = TestCodeBehindData.FeatureWithScenarioAndStepAndParameter("string"); features[0].Scenarios[0].Steps.Add(new NodeStep("WhenIHaveAStep")); features[0].Scenarios[0].Steps[0].Rows = new List <string[]>() { new[] { "a", "b", "c" }, new[] { "1", "2", "3" } }; 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\tstd::vector<std::vector<std::string>> table0 = {{", "\t\t\t{ \"a\", \"b\", \"c\" },", "\t\t\t{ \"1\", \"2\", \"3\" }", "\t\t}};", string.Format("\t\t{0}(table0,{1},{2},\"{3}\");", features[0].Scenarios[0].Steps[0].Name, features[0].Scenarios[0].Steps[0].Rows.Count, features[0].Scenarios[0].Steps[0].Rows[0].Length, features[0].Scenarios[0].Steps[0].Parameters[0].Value ), string.Format("\t\t{0}();", features[0].Scenarios[0].Steps[1].Name), "\t}", "}" }; AssertExt.ContentsOfStringArray(stringsExpected, files[0]); }