Metalama 1.0 / / Metalama Documentation / Advanced API Documentation / Metalama.​Test­Framework

Namespace Metalama.TestFramework

This namespaces contains the framework that allows you to test how your custom aspects transform your code. For more information, see Compile-Time Testing.

Classes

AspectTestFramework

Implementation of a Xunit test framework for Metalama. Fall backs to the default XUnit framework in Resharper or Rider.

AspectTestRunner

Executes aspect integration tests by running the full aspect pipeline on the input source file.

BaseTestRunner

An abstract class for all template-base tests.

BaseTestRunner.Observer

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.

DefaultTestSuite

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

FileExtensions

List of file extensions used by the test framework.

TestAssemblyReference

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

TestDirectoryOptions

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

TestInput

Represents the parameters of the integration test input.

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.

TestProjectProperties

Properties of a test project.

TestProjectReferences

TestResult

Represents the result of a test run.

TestSuite

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.

TestSyntaxTree

Represents the test results for a syntax tree in TestResult.

TestTemplateAttribute

UnloadableCompileTimeDomain

An implementation of Metalama.Framework.Engine.CompileTime.CompileTimeDomain base on AssemblyLoadContext and able to unload itself. When compiled with .NET Standard (instead of .NET 5.0), the class has no unloading effect.

Interfaces

ITestRunnerFactory

Creates a specific instance of the BaseTestRunner class.