当前位置: 首页>>代码示例>>C#>>正文


C# SyntaxElements.Feature类代码示例

本文整理汇总了C#中TechTalk.SpecFlow.Parser.SyntaxElements.Feature的典型用法代码示例。如果您正苦于以下问题:C# Feature类的具体用法?C# Feature怎么用?C# Feature使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Feature类属于TechTalk.SpecFlow.Parser.SyntaxElements命名空间,在下文中一共展示了Feature类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CompareWithExpectedResult

        private void CompareWithExpectedResult(Feature feature, string expectedResultFileName)
        {
            string expected = TestFileHelper.ReadFile(expectedResultFileName).Replace("\r", "");
            string got = SerializeFeature(feature).Replace("\r", "");

            Assert.AreEqual(expected, got);
        }
开发者ID:roffster,项目名称:SpecFlow,代码行数:7,代码来源:SuccessfulParsingTest.cs

示例2: CompileAndCreateTest

        private object CompileAndCreateTest(string fileName, Feature feature)
        {
            string className = Path.GetFileNameWithoutExtension(fileName);
            const string targetNamespace = "Target.Namespace";
            // the row test generation has to be set to false, because our verifications support the old style test generation only
            SpecFlowUnitTestConverter converter = new SpecFlowUnitTestConverter(CreateUnitTestGeneratorProvider(), new CodeDomHelper(CodeDomProviderLanguage.CSharp), new GeneratorConfiguration { AllowRowTests = false, AllowDebugGeneratedFiles = true }); 
            var codeNamespace = converter.GenerateUnitTestFixture(feature, className, targetNamespace);
            var compileUnit = new CodeCompileUnit();
            compileUnit.Namespaces.Add(codeNamespace);

            Dictionary<string, string> providerOptions = new Dictionary<string, string>();
            providerOptions["CompilerVersion"] = "v3.5";

            CSharpCodeProvider codeProvider = new CSharpCodeProvider(providerOptions);

            CompilerParameters compilerParameters = new CompilerParameters();
            compilerParameters.GenerateInMemory = true;
            compilerParameters.TempFiles.KeepFiles = true;

            compilerParameters.ReferencedAssemblies.Add(
                TestFileHelper.GetAssemblyPath(typeof (GeneratedCodeAttribute))); //System
            compilerParameters.ReferencedAssemblies.Add(
                TestFileHelper.GetAssemblyPath(typeof (TestAttribute))); //NUnit
            compilerParameters.ReferencedAssemblies.Add(
                TestFileHelper.GetAssemblyPath(typeof (ITestRunner))); //TechTalk.SpecFlow

            var results = codeProvider.CompileAssemblyFromDom(compilerParameters, compileUnit);

            if (results.NativeCompilerReturnValue != 0)
                throw new InvalidOperationException("Test cannot be compiled: " + 
                                                    string.Join(Environment.NewLine, results.Errors.Cast<CompilerError>().Select(ce => ce.ToString()).ToArray()));

            Type testType = results.CompiledAssembly.GetType(targetNamespace + "." + className, true);
            return Activator.CreateInstance(testType);
        }
开发者ID:roffster,项目名称:SpecFlow,代码行数:35,代码来源:ExecutionTestBase.cs

示例3: CompareWithExpectedResult

        private void CompareWithExpectedResult(Feature feature, string expectedResultFileName)
        {
            string expected = TestFileHelper.ReadFile(expectedResultFileName);
            string got = GenerateCodeFromFeature(feature);

            Assert.AreEqual(expected, got);
        }
开发者ID:nandrew,项目名称:SpecFlow,代码行数:7,代码来源:SuccessfulMbUnitGenerationTest.cs

示例4: MatchPrefix

        public static bool MatchPrefix(this ITagFilterMatcher tagFilterMatcher, string tagFilter, Feature feature)
        {
            if (feature.Tags == null)
                return false;

            return tagFilterMatcher.MatchPrefix(tagFilter, feature.Tags.Select(t => t.Name));
        }
开发者ID:BEllis,项目名称:SpecFlow,代码行数:7,代码来源:ITagFilterMatcher.cs

示例5: GenerateCodeFromFeature

 private void GenerateCodeFromFeature(Feature feature, string fileName)
 {
     using (var writer = new StreamWriter(fileName, false, Encoding.UTF8))
     {
         GenerateCodeFromFeature(feature, writer);
     }
 }
开发者ID:nandrew,项目名称:SpecFlow,代码行数:7,代码来源:SuccessfulMbUnitGenerationTest.cs

示例6: SerializeFeature

 private void SerializeFeature(Feature feature, string fileName)
 {
     using (var writer = new StreamWriter(fileName, false, Encoding.UTF8))
     {
         SerializeFeature(feature, writer);
     }
 }
开发者ID:Galad,项目名称:SpecFlow,代码行数:7,代码来源:ParserDriver.cs

示例7: Should_UnitTestFeatureGeneratorProvider_create_UnitTestFeatureGenerator_instance

        public void Should_UnitTestFeatureGeneratorProvider_create_UnitTestFeatureGenerator_instance()
        {
            var generatorProvider = CreateUnitTestFeatureGeneratorProvider();
            Feature anyFeature = new Feature();
            var generator = generatorProvider.CreateGenerator(anyFeature);

            generator.Should().BeOfType<UnitTestFeatureGenerator>();
        }
开发者ID:aqueduct,项目名称:SpecflowWithNunitRunner,代码行数:8,代码来源:FeatureGeneratorProviderTests.cs

示例8: Should_UnitTestFeatureGeneratorProvider_create_valid_instance

        public void Should_UnitTestFeatureGeneratorProvider_create_valid_instance()
        {
            var generatorProvider = CreateUnitTestFeatureGeneratorProvider();
            Feature anyFeature = new Feature();
            var generator = generatorProvider.CreateGenerator(anyFeature);

            generator.Should().NotBeNull();
        }
开发者ID:aqueduct,项目名称:SpecflowWithNunitRunner,代码行数:8,代码来源:FeatureGeneratorProviderTests.cs

示例9: SerializeFeature

 private string SerializeFeature(Feature feature)
 {
     using (var writer = new Utf8StringWriter())
     {
         SerializeFeature(feature, writer);
         return writer.ToString();
     }
 }
开发者ID:roffster,项目名称:SpecFlow,代码行数:8,代码来源:SuccessfulParsingTest.cs

示例10: ScenarioOutlineViewModel

        public ScenarioOutlineViewModel(Feature feature, ScenarioOutline scenarioOutline)
            : base(scenarioOutline, feature)
        {
            var bgSteps = feature.Background != null ? feature.Background.Steps.AsEnumerable() : Enumerable.Empty<ScenarioStep>();

            StepTemplates = bgSteps.Concat(scenarioOutline.Steps).Select(x => new StepTemplateViewModel(x)).ToList();

            Examples = scenarioOutline.Examples.ExampleSets.Select(x => new ScenarioOutlineExampleSetViewModel(this, x)).ToList();
        }
开发者ID:robfe,项目名称:SpecShow,代码行数:9,代码来源:ScenarioOutlineViewModel.cs

示例11: ExecuteTests

 protected override void ExecuteTests(object test, Feature feature)
 {
     NUnitTestExecutor.ExecuteNUnitTests(test,
         delegate(Exception exception)
         {
             Assert.IsInstanceOf(typeof(InconclusiveException), exception);
             return true;
         });
 }
开发者ID:roffster,项目名称:SpecFlow,代码行数:9,代码来源:SuccessfulExecutionTest.cs

示例12: Should_create_UnitTestFeatureGenerator_with_default_setup

        public void Should_create_UnitTestFeatureGenerator_with_default_setup()
        {
            var featureGeneratorRegistry = CreateFeatureGeneratorRegistry();

            Feature anyFeature = new Feature();
            var generator = featureGeneratorRegistry.CreateGenerator(anyFeature);

            generator.Should().BeOfType<UnitTestFeatureGenerator>();
        }
开发者ID:Galad,项目名称:SpecFlow,代码行数:9,代码来源:FeatureGeneratorRegistryTests.cs

示例13: GenerateCodeFromFeature

        private void GenerateCodeFromFeature(Feature feature, TextWriter writer)
        {
            SpecFlowUnitTestConverter converter = FactoryMethods.CreateUnitTestConverter(new NUnitTestConverter());
            var codeNamespace = converter.GenerateUnitTestFixture(feature, "TestClassName", "Target.Namespace");

            CSharpCodeProvider codeProvider = new CSharpCodeProvider();
            CodeGeneratorOptions options = new CodeGeneratorOptions();
            codeProvider.GenerateCodeFromNamespace(codeNamespace, writer, options);
        }
开发者ID:roffster,项目名称:SpecFlow,代码行数:9,代码来源:SuccessfulGenerationTest.cs

示例14: GetTagValue

        public static bool GetTagValue(this ITagFilterMatcher tagFilterMatcher, string tagFilter, Feature feature, out string value)
        {
            if (feature.Tags == null)
            {
                value = null;
                return false;
            }

            return tagFilterMatcher.GetTagValue(tagFilter, feature.Tags.Select(t => t.Name), out value);
        }
开发者ID:BEllis,项目名称:SpecFlow,代码行数:10,代码来源:ITagFilterMatcher.cs

示例15: FeatureViewModel

        public FeatureViewModel(Feature feature)
        {
            FeatureNode = feature;
            if (feature.Background != null)
            {
                BackgroundSteps = feature.Background.Steps.Select(x => new StepViewModel(x)).ToList();
            }

            Scenarios = feature.Scenarios.Select(x => x is ScenarioOutline ? (ScenarioViewModelBase)new ScenarioOutlineViewModel(feature, (ScenarioOutline) x) : new ScenarioViewModel(feature, x)).ToList();
        }
开发者ID:robfe,项目名称:SpecShow,代码行数:10,代码来源:FeatureViewModel.cs


注:本文中的TechTalk.SpecFlow.Parser.SyntaxElements.Feature类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。