示例#1
0
        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);
        }
示例#3
0
 public void CanParseFiles()
 {
     foreach (var testFile in TestFileHelper.GetTestFiles())
     {
         CanParseFile(testFile);
     }
 }
 public void CanGenerateFromFiles()
 {
     foreach (var testFile in TestFileHelper.GetTestFiles())
     {
         CanGenerateFromFile(testFile);
     }
 }
示例#5
0
        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"));
        }
示例#8
0
        public void CanParsebackgroundFeature()
        {
            var folder = Path.GetFullPath(Path.Combine(TestFileHelper.GetProjectLocation(), "TestFiles"));

            CanParseFile(Path.Combine(folder, "background.feature"));
        }
示例#9
0
        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"));
        }
示例#11
0
        public void CanParseHungarianFeature()
        {
            var folder = Path.GetFullPath(Path.Combine(TestFileHelper.GetProjectLocation(), "TestFiles"));

            CanParseFile(Path.Combine(folder, "hungarian.feature"));
        }
示例#12
0
        public void CanGenerateAsterisksFeature()
        {
            var folder = Path.GetFullPath(Path.Combine(TestFileHelper.GetProjectLocation(), "TestFiles"));

            CanParseFile(Path.Combine(folder, "asterisks.feature"));
        }
示例#13
0
        public void CanParseTableargumentFeature()
        {
            var folder = Path.GetFullPath(Path.Combine(TestFileHelper.GetProjectLocation(), "TestFiles"));

            CanParseFile(Path.Combine(folder, "tableargument.feature"));
        }
示例#14
0
        public void CanParseMultilinetitleFeature()
        {
            var folder = Path.GetFullPath(Path.Combine(TestFileHelper.GetProjectLocation(), "TestFiles"));

            CanParseFile(Path.Combine(folder, "multilinetitle.feature"));
        }
示例#15
0
        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"));
        }
示例#17
0
        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"));
        }
示例#19
0
        public void CanGenerateMultilineargumentFeature()
        {
            string folder = Path.GetFullPath(Path.Combine(TestFileHelper.GetProjectLocation(), "TestFiles"));

            CanGenerateFromFile(Path.Combine(folder, "multilineargument.feature"));
        }