public CodeNamespace GenerateUnitTestFixture(Feature feature, string testClassName, string targetNamespace) { targetNamespace = targetNamespace ?? DEFAULT_NAMESPACE; testClassName = testClassName ?? string.Format(FIXTURE_FORMAT, feature.Title.ToIdentifier()); CodeNamespace codeNamespace = new CodeNamespace(targetNamespace); codeNamespace.Imports.Add(new CodeNamespaceImport(SPECFLOW_NAMESPACE)); var testType = codeDomHelper.CreateGeneratedTypeDeclaration(testClassName); testType.IsPartial = true; testType.TypeAttributes |= TypeAttributes.Public; codeNamespace.Types.Add(testType); AddLinePragmaInitial(testType, feature); testGeneratorProvider.SetTestFixture(testType, feature.Title, feature.Description); if (feature.Tags != null) { testGeneratorProvider.SetTestFixtureCategories(testType, GetNonIgnoreTags(feature.Tags)); if (HasIgnoreTag(feature.Tags)) { testGeneratorProvider.SetIgnore(testType); } } DeclareTestRunnerMember(testType); GenerateTestFixtureSetup(testType, feature); GenerateTestFixtureTearDown(testType); var testSetup = GenerateTestSetup(testType); GenerateTestTearDown(testType); if (feature.Background != null) { GenerateBackground(testType, testSetup, feature.Background); } foreach (var scenario in feature.Scenarios) { if (scenario is ScenarioOutline) { GenerateScenarioOutlineTest(testType, testSetup, (ScenarioOutline)scenario, feature); } else { GenerateTest(testType, testSetup, scenario, feature); } } //before return the generated code, call generate provider's method in case the provider want to customerize the generated code testGeneratorProvider.FinalizeTestClass(codeNamespace); return(codeNamespace); }