Open sandboxFocus

Class CurrentDirectoryAttribute

An xUnit data attribute that generates test cases from snapshot test files in the current directory.

Inheritance
DataAttribute
CurrentDirectoryAttribute
Namespace: Metalama.Testing.AspectTesting
Assembly: Metalama.Testing.AspectTesting.dll
Syntax
[Obsolete("This class is obsolete. Use the default snapshot test project setup provided by Metalama.Testing.AspectTesting instead.")]
public sealed class CurrentDirectoryAttribute : DataAttribute
Remarks

This attribute is used with [Theory] to automatically discover test files (typically *.cs files) in a directory and generate a test case for each file. Use this in conjunction with AspectTestClass.

The attribute excludes:

  • Subdirectories that contain a file named _Runner.cs
  • Subdirectories covered by another test method in the same class

Test discovery respects options from metalamaTests.json files.

Constructors

Name Description
CurrentDirectoryAttribute(string?, string?)

Initializes a new instance of the CurrentDirectoryAttribute class.

Properties

Name Description
Directory

Gets the root directory of test files for the current test methods.

Methods

Name Description
GetData(MethodInfo)

Returns the data to be used to test the theory.

Extension Methods

See Also