TechTalk.SpecFlow.Generator.UnitTestProvider.XUnitTestGeneratorProvider.SetTestInitializeMethod C# (CSharp) Méthode

SetTestInitializeMethod() public méthode

public SetTestInitializeMethod ( TestClassGenerationContext generationContext ) : void
generationContext TestClassGenerationContext
Résultat void
        public void SetTestInitializeMethod(TestClassGenerationContext generationContext)
        {
            // xUnit uses a parameterless constructor

            // public <_currentTestTypeDeclaration>() { <memberMethod>(); }

            CodeConstructor ctorMethod = new CodeConstructor();
            ctorMethod.Attributes = MemberAttributes.Public;
            generationContext.TestClass.Members.Add(ctorMethod);

            ctorMethod.Statements.Add(
                new CodeMethodInvokeExpression(
                    new CodeThisReferenceExpression(),
                    generationContext.TestInitializeMethod.Name));
        }