public void StepDefinitionParsesFileWithTwoFeaturesOneStepAndOneTableParameterEach() { string[] stepDefinitionFile1 = new string[] { "#include \"Feature1.h\"", "", "namespace CppUnitTest", "{", "\tvoid Feature1::GivenASentence1(std::vector<std::vector<std::string>> table, int rows, int cols)", "\t{", "\t\tAssert::Fail(L\"Pending implementation...\");", "\t{", "", "\tvoid Feature2::GivenASentence2(std::vector<std::vector<std::string>> table, int rows, int cols)", "\t{", "\t\tAssert::Fail(L\"Pending implementation...\");", "\t{", "}" }; StepDefinitionParser parser = new StepDefinitionParser(); List <FeatureGroup> featureGroup = parser.Parse(stepDefinitionFile1); Assert.AreEqual("Feature1", featureGroup[0].FeatureName); Assert.AreEqual("GivenASentence1", featureGroup[0].Steps[0].Name); Assert.AreEqual(0, featureGroup[0].Steps[0].Parameters.Count, "table counted as a parameter"); Assert.AreEqual(1, featureGroup[0].Steps[0].Rows.Count, "table doesn't have any rows"); Assert.AreEqual("Feature2", featureGroup[1].FeatureName); Assert.AreEqual("GivenASentence2", featureGroup[1].Steps[0].Name); Assert.AreEqual(0, featureGroup[0].Steps[0].Parameters.Count, "table counted as a parameter"); Assert.AreEqual(1, featureGroup[0].Steps[0].Rows.Count, "table doesn't have any rows"); }
public void StepDefinitionParsesFileWithOneFeatureOneStepAndTwoParameters() { string[] stepDefinitionFile1 = new string[] { "#include \"feature1.h\"", "", "namespace CppUnitTest", "{", "\tvoid Feature1::GivenASentence(string Parameter1, string Parameter2)", "\t{", "\t\tAssert::Fail(L\"Pending implementation...\");", "\t{", "}" }; StepDefinitionParser parser = new StepDefinitionParser(); List <FeatureGroup> featureGroup = parser.Parse(stepDefinitionFile1); Assert.AreEqual("Feature1", featureGroup[0].FeatureName); Assert.AreEqual("GivenASentence", featureGroup[0].Steps[0].Name); Assert.AreEqual("string", featureGroup[0].Steps[0].Parameters[0].Type); Assert.AreEqual("Parameter1", featureGroup[0].Steps[0].Parameters[0].Name); Assert.AreEqual("string", featureGroup[0].Steps[0].Parameters[1].Type); Assert.AreEqual("Parameter2", featureGroup[0].Steps[0].Parameters[1].Name); }
public void StepDefinitionParsesFileWithTwoFeaturesAndOneStep() { string[] stepDefinitionFile1 = new string[] { "#include \"Feature1.h\"", "", "namespace CppUnitTest", "{", "\tvoid Feature1::GivenASentence1()", "\t{", "\t\tAssert::Fail(L\"Pending implementation...\");", "\t{", "", "\tvoid Feature2::GivenASentence2()", "\t{", "\t\tAssert::Fail(L\"Pending implementation...\");", "\t{", "}" }; StepDefinitionParser parser = new StepDefinitionParser(); List <FeatureGroup> featureGroup = parser.Parse(stepDefinitionFile1); Assert.AreEqual("Feature1", featureGroup[0].FeatureName); Assert.AreEqual("GivenASentence1", featureGroup[0].Steps[0].Name); Assert.AreEqual("Feature2", featureGroup[1].FeatureName); Assert.AreEqual("GivenASentence2", featureGroup[1].Steps[0].Name); }