Open sandboxFocusImprove this doc

Namespace Metalama.Testing.AspectTesting

This namespace contains the framework that allows you to test how your custom aspects transform your code. For more information, see Testing the aspect's code generation and error reporting.

Classes

AspectTestClass

A base class for test classes built using the current framework. All test methods must be annotated with both [Theory] and CurrentDirectoryAttribute, must have a single parameter accepting the relative path of the test file, and must call RunTestAsync(string, string?) as their only implementation.

AspectTestFramework

CurrentDirectoryAttribute

An implementation of SyntaxAttribute that generates test cases from files in the current directory. To be used with [Theory]. This attribute will not include subdirectories that contain a file named _Runner.cs, nor subdirectories that are covered by another test method of the same class. It also takes into account the metalamaTests.config file.

CurrentProjectAttribute

An implementation of SyntaxAttribute that generates test cases from files in the current project. To be used with [Theory]. This attribute will not include subdirectories that contain a file named _Runner.cs. It also takes into account the metalamaTests.config file.

DefaultAspectTestClass

The base class for the test suite that is automatically included in user projects.

FileExtensions

List of file extensions used by the test framework.

InvalidTestOptionException

InvalidTestTargetException

TestAssemblyReference

Represents a metadata reference. This class is JSON-serializable.

TestDirectoryOptions

Represent the content of the metalamaTests.json file. This class is JSON-serializable.

TestLiveTemplateAttribute

A custom that must be used in the LiveTemplate and LiveTemplatePreview to mark the declaration to which the aspect must be applied. The presence of this attribute simulates the use of the refactoring context menu.

TestOptions

A set of test options, which can be included in the source text of tests using special comments like // @ReportOutputWarnings. This class is JSON-serializable. Another way to define options is to add a file named metalamaTests.json into the test directory or any parent directory.

TestOutputNormalizer

TestRunnerOptions

TestSyntaxTree

Represents the test results for a syntax tree in TestResult.

Enums

TestScenario

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

TestSyntaxTreeKind