Skip to content

Requirement Attribute

Averrunci edited this page Jun 7, 2022 · 6 revisions

This attribute specifies a class as a requirement fixture.

Carna does not search a class (not a nested class) specified by this attribute as a fixture to be run. It can be searched when the member (property or field) is defined using its type.

The available properties are as follows.

Property Description
Description Specifies a description of a fixture.
Fixtures Specifies types of fixtures that are contained by a fixture.
Tag Specifies a tag to filter a fixture.
Benefit Specifies a benefit about a fixture.
Role Specifies a role about a fixture.
Feature Specifies a feature about a fixture.
CanRunParallel Specifies a value that indicates whether child fixtures can be run in parallel. The default value is false.
IsRootFixture Specifies a value that indicates whether this fixture is searched as a fixture to be run. The default value is false.
RequiresSta Specifies a value that indicates whether to run this fixture in a single thread apartment. The default value is false.

For examlple:

[Feature("Tic-Tac-Toe")]
class TicTacToeFeature
{
    [Requirement("The result is a draw when all the boxes are filled")]
    class Requirement01
    {
        ...
    }
}
[Feature("Tic-Tac-Toe")]
class TicTacToeFeature
{
    [Requirement]
    TicTacToeFeature_Requirement01 Requirement01 { get; }    
}

[Requirement("The result is a draw when all the boxes are filled")]
class TicTacToeFeature_Requirement01
{
    ...
}
[Feature(
    "Tic-Tac-Toe"
    typeof(TicTacToeFeature_Requirement01)
)]
class TicTacToeFeature
{
}

[Requirement("The result is a draw when all the boxes are filled")]
class TicTacToeFeature_Requirement01
{
    ...
}
Clone this wiki locally