コード例 #1
0
        private void SetupFeatureBackground(TestClassGenerationContext generationContext)
        {
            if (!generationContext.Feature.HasFeatureBackground())
            {
                return;
            }
            var backgroundMethod = generationContext.FeatureBackgroundMethod;

            backgroundMethod.Attributes = MemberAttributes.Public;
            backgroundMethod.Name       = "FeatureBackground";
            var background = generationContext.Feature.Background;

            _codeDomHelper.AddLineDirective(background, backgroundMethod.Statements, _specFlowConfiguration);
            foreach (var step in background.Steps)
            {
                GenerateStep(backgroundMethod, step, null);
            }
            _codeDomHelper.AddLineDirectiveHidden(backgroundMethod.Statements, _specFlowConfiguration);
        }