Story text
Apply [Story] to a test class to describe its role, goal, and benefit:
using BDTest;
[Story(AsA = "engineer", IWant = "to run scenarios", SoThat = "reports explain their purpose")]
public class ScenarioTests : TUnitBDTestBase<object>
{
}
StoryAttribute.GetStoryText() returns three lines and a trailing newline:
As an engineer
I want to run scenarios
So that reports explain their purpose
Formatting never changes AsA, AsAn, IWant, or SoThat. Repeated calls on the
same attribute return the same text while its property values remain unchanged.
Role articles
Supply exactly one of AsA or AsAn:
- A complete
As a ...orAs an ...phrase is preserved, including its casing. - An explicit article is preserved:
AsA = "a user"becomesAs a user, andAsA = "an engineer"becomesAs an engineer. - Otherwise,
AsAusesanbefore a vowel letter (a,e,i,o,u), ignoring case, andabefore other letters. Roles starting withuserusea, soAsA = "user"becomesAs a user. AsAnexplicitly selectsanfor a role without an article:AsAn = "owl"becomesAs an owl.
Article selection is a spelling rule, not a pronunciation dictionary. Supply an
explicit article or a complete phrase for other pronunciation exceptions, such as
AsA = "a university student" or AsAn = "hourly worker".
Prefixes and validation
I want and So that are added only when absent. All prefix checks ignore case
and require a whole word: the prefix must end the value or be followed by a
character other than a letter, digit, or underscore. For example, I wanted ...
becomes I want I wanted ...; As another user becomes As an As another user.
Null or empty roles, goals, or benefits still throw
MissingStoryTextArgumentException. Supplying both AsA and AsAn still throws
DuplicateStoryTextArgumentException.