private void CompareWithExpectedResult(Feature feature, string expectedResultFileName) { string expected = TestFileHelper.ReadFile(expectedResultFileName).Replace("\r", ""); string got = SerializeFeature(feature).Replace("\r", ""); Assert.AreEqual(expected, got); }
private void CompareWithExpectedResult(Feature feature, string expectedResultFileName) { string expected = TestFileHelper.ReadFile(expectedResultFileName); string got = GenerateCodeFromFeature(feature); Assert.AreEqual(expected, got); }
public void CanParseFiles() { foreach (var testFile in TestFileHelper.GetTestFiles()) { CanParseFile(testFile); } }
public void CanGenerateFromFiles() { foreach (var testFile in TestFileHelper.GetTestFiles()) { CanGenerateFromFile(testFile); } }
public void GenerateScenarioExampleTests() { SpecFlowLangParser parser = new SpecFlowLangParser(new CultureInfo("en-US")); foreach (var testFile in TestFileHelper.GetTestFiles()) { using (var reader = new StreamReader(testFile)) { Feature feature = parser.Parse(reader, null); Assert.IsNotNull(feature); Console.WriteLine("Testing {0}", Path.GetFileName(testFile)); var codeDomHelper = new CodeDomHelper(CodeDomProviderLanguage.CSharp); var sampleTestGeneratorProvider = new SimpleTestGeneratorProvider(); var converter = new SpecFlowUnitTestConverter(sampleTestGeneratorProvider, codeDomHelper, true, true); CodeNamespace code = converter.GenerateUnitTestFixture(feature, "TestClassName", "Target.Namespace"); Assert.IsNotNull(code); // make sure name space is changed Assert.AreEqual(code.Name, SimpleTestGeneratorProvider.DefaultNameSpace); // make sure all method titles are changed correctly List <string> methodTitles = new List <string>(); for (int i = 0; i < code.Types[0].Members.Count; i++) { methodTitles.Add(code.Types[0].Members[i].Name); } foreach (var title in sampleTestGeneratorProvider.newTitles) { Assert.IsTrue(methodTitles.Contains(title)); } } } }
public void CanGenerateMixedGWTFeature() { var folder = Path.GetFullPath(Path.Combine(TestFileHelper.GetProjectLocation(), "TestFiles")); CanGenerateFromFile(Path.Combine(folder, "mixedgivenwhenthen.feature")); }
public void CanGenerateScneriooutlineFeature() { var folder = Path.GetFullPath(Path.Combine(TestFileHelper.GetProjectLocation(), "TestFiles")); CanGenerateFromFile(Path.Combine(folder, "scenariooutline.feature")); }
public void CanParsebackgroundFeature() { var folder = Path.GetFullPath(Path.Combine(TestFileHelper.GetProjectLocation(), "TestFiles")); CanParseFile(Path.Combine(folder, "background.feature")); }
public void CanGenerateFeatureheaderFeature() { string folder = Path.GetFullPath(Path.Combine(TestFileHelper.GetProjectLocation(), "TestFiles")); CanGenerateFromFile(Path.Combine(folder, "featureheader.feature")); }
public void CanGenerateGivenWhenThenDuplicationFeatureFeature() { var folder = Path.GetFullPath(Path.Combine(TestFileHelper.GetProjectLocation(), "TestFiles")); CanGenerateFromFile(Path.Combine(folder, "givenwhenthenduplication.feature")); }
public void CanParseHungarianFeature() { var folder = Path.GetFullPath(Path.Combine(TestFileHelper.GetProjectLocation(), "TestFiles")); CanParseFile(Path.Combine(folder, "hungarian.feature")); }
public void CanGenerateAsterisksFeature() { var folder = Path.GetFullPath(Path.Combine(TestFileHelper.GetProjectLocation(), "TestFiles")); CanParseFile(Path.Combine(folder, "asterisks.feature")); }
public void CanParseTableargumentFeature() { var folder = Path.GetFullPath(Path.Combine(TestFileHelper.GetProjectLocation(), "TestFiles")); CanParseFile(Path.Combine(folder, "tableargument.feature")); }
public void CanParseMultilinetitleFeature() { var folder = Path.GetFullPath(Path.Combine(TestFileHelper.GetProjectLocation(), "TestFiles")); CanParseFile(Path.Combine(folder, "multilinetitle.feature")); }
public void CanParseCommentsFeature() { var folder = Path.GetFullPath(Path.Combine(TestFileHelper.GetProjectLocation(), "TestFiles")); CanParseFile(Path.Combine(folder, "comments.feature")); }
public void CanGeneratebackgroundWithTitleFeature() { var folder = Path.GetFullPath(Path.Combine(TestFileHelper.GetProjectLocation(), "TestFiles")); CanGenerateFromFile(Path.Combine(folder, "background_withtitle.feature")); }
public void CanParseTaggedExamplesFeature() { var folder = Path.GetFullPath(Path.Combine(TestFileHelper.GetProjectLocation(), "TestFiles")); CanParseFile(Path.Combine(folder, "taggedexamples.feature")); }
public void CanGenerateButFeature() { var folder = Path.GetFullPath(Path.Combine(TestFileHelper.GetProjectLocation(), "TestFiles")); CanGenerateFromFile(Path.Combine(folder, "but.feature")); }
public void CanGenerateMultilineargumentFeature() { string folder = Path.GetFullPath(Path.Combine(TestFileHelper.GetProjectLocation(), "TestFiles")); CanGenerateFromFile(Path.Combine(folder, "multilineargument.feature")); }