Beispiel #1
0
        public void SetupTestCleanupMethod()
        {
            var testCleanupMethod = GenerationContext.TestCleanupMethod;

            testCleanupMethod.Attributes = MemberAttributes.Public;
            testCleanupMethod.Name       = "ScenarioTearDown";
            _testGeneratorProvider.SetTestCleanupMethod(GenerationContext);
            var runnerExpression = GetTestRunnerExpression();

            testCleanupMethod.Statements.Add(new CodeMethodInvokeExpression(runnerExpression, "OnScenarioEnd", new CodeExpression[0]));
        }
        private void SetupTestCleanupMethod(TestClassGenerationContext generationContext)
        {
            CodeMemberMethod testCleanupMethod = generationContext.TestCleanupMethod;

            testCleanupMethod.Attributes = MemberAttributes.Public;
            testCleanupMethod.Name       = TEST_CLEANUP_NAME;

            testGeneratorProvider.SetTestCleanupMethod(generationContext);

            var testRunnerField = GetTestRunnerExpression();

            //testRunner.OnScenarioEnd();
            testCleanupMethod.Statements.Add(
                new CodeMethodInvokeExpression(
                    testRunnerField,
                    "OnScenarioEnd"));
        }
Beispiel #3
0
        private void SetupTestCleanupMethod(TestClassGenerationContext generationContext)
        {
            var testCleanupMethod = generationContext.TestCleanupMethod;

            testCleanupMethod.ReturnType = new CodeTypeReference(typeof(Task));
            testCleanupMethod.Attributes = MemberAttributes.Public;
            testCleanupMethod.Name       = GeneratorConstants.TEST_CLEANUP_NAME;

            _testGeneratorProvider.MarkCodeMemberMethodAsAsync(testCleanupMethod);

            _testGeneratorProvider.SetTestCleanupMethod(generationContext);

            var testRunnerField = _scenarioPartHelper.GetTestRunnerExpression();
            //await testRunner.OnScenarioEndAsync();
            var expression = new CodeMethodInvokeExpression(
                testRunnerField,
                nameof(ITestRunner.OnScenarioEndAsync));

            _codeDomHelper.MarkCodeMethodInvokeExpressionAsAwait(expression);

            testCleanupMethod.Statements.Add(expression);
        }
        public void SetTestCleanupMethod(TestClassGenerationContext generationContext)
        {
            _unitTestGeneratorProvider.SetTestCleanupMethod(generationContext);

            UpdateAttributes(generationContext.TestCleanupMethod);
        }
Beispiel #5
0
 public void SetTestCleanupMethod(TestClassGenerationContext generationContext)
 {
     baseGeneratorProvider.SetTestCleanupMethod(generationContext);
 }
 public void SetTestCleanupMethod(TestClassGenerationContext generationContext)
 {
     _innerGenerator.SetTestCleanupMethod(generationContext);
 }