Open sandboxFocus

Enum TestScenario

Specifies the scenario to simulate when running a snapshot test.

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

This enum controls what aspect of the aspect system is being tested: compilation-time transformation, code fix application, live template application, design-time behavior, or diff preview.

Set the test scenario using the // @TestScenario(scenarioName) comment in your test file, or configure it via 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).

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).

See Also