Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,27 @@ public static void ThenTheFieldIsMandatory(string fieldName, string requirementL
fieldContainer.GetAttribute<int>("data-fieldrequirement").Should().Be(requirementLevel == "mandatory" ? 2 : 0, because: $"the field should be {requirementLevel}");
}

/// <summary>
/// Asserts that a set of fields are mandatory or optional.
/// </summary>
/// <param name="requirementLevel">Whether the field should be mandatory or optional.</param>
/// <param name="table">The names of the fields.</param>
[Then("the following fields are (mandatory|optional)")]
public static void ThenTheFieldsAreMandatory(string requirementLevel, Table table)
{
if (table is null)
{
throw new ArgumentNullException(nameof(table));
}

var fields = table.Rows.Select(x => x.Values.First());

foreach (var field in fields)
{
ThenTheFieldIsMandatory(field, requirementLevel);
}
}

/// <summary>
/// Asserts that a value is shown in a boolean field.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,18 @@ Scenario: Assert a field is optional
Scenario: Assert a field is required
Then the 'sb_name' field is mandatory

Scenario: Assert a set of fields are optional
Then the following fields are optional
| fields |
| sb_text |
| sb_number |
| sb_yesno |

Scenario: Assert a set of fields are mandatory
Then the following fields are mandatory
| fields |
| sb_name |

Scenario Outline: Assert fom notification message
Then I can see <type> form notification stating '<text>'

Expand Down