MetalamaAPI documentationAdvanced APIMetalama.​Testing.​Aspect­TestingTest­Scenario
Open sandboxFocus

TestScenario Enum

Enumerates the scenarios that are simulated for the test, for instance compilation (the Default scenario), applying a code fix, or others.

Namespace: Metalama.Testing.AspectTesting
Assembly: Metalama.Testing.AspectTesting.dll
Syntax
public enum TestScenario

Fields

Name Description
CodeFix

Tests the application of a code fix. By default, the first suggested code fix is applied. To apply a different code fix, use the AppliedCodeFixIndex property. To set this scenario in a test, add this comment to your test file: // @TestScenario(CodeFix).

CodeFixPreview

Tests the preview of a code fix. By default, the first suggested code fix is applied. To apply a different code fix, use the AppliedCodeFixIndex property. To enable this option in a test, add this comment to your test file: // @TestScenario(CodeFixPreview).

Default

The default test scenario is that the code is transformed as during compilation.

DesignTime

Tests the background code and diagnostic generation at design time. To enable this option in a test, add this comment to your test file: // @TestScenario(DesignTime).

LiveTemplate

Tests the application of an aspect as a live template. The test file must contain a single attribute of type TestLiveTemplateAttribute indicating the target and the type of the aspect to be applied. To enable this option in a test, add this comment to your test file: // @TestScenario(LiveTemplate).

LiveTemplatePreview

Tests the preview of an aspect as a live template. The test file must contain a single attribute of type TestLiveTemplateAttribute indicating the target and the type of the aspect to be applied. To enable this option in a test, add this comment to your test file: // @TestScenario(LiveTemplatePreview).

Preview

Tests the output of the "diff preview" feature. To enable this option in a test, add this comment to your test file: // @TestScenario(Preview).