Reputation: 1169
If I have a unit test with string parameter, and I want to check if the input string has a comma (,
) somewhere, I should create an input string with a comma in it.
But how to pass it to the TestCase?
[Test]
[TestCase('TestA', '12,34')] //AValue1 gets only '12' instead of '12,34'
[TestCase('TestB', '12,,34')] //AValue1 gets only '12' instead of '12,34'
[TestCase('TestC', '12/,34')] //AValue1 gets only '12/' instead of '12,34'
[TestCase('TestD', '12\,34')] //AValue1 gets only '12\' instead of '12,34'
procedure ValueShouldHaveComma(const AValue1: string);
Upvotes: 7
Views: 908
Reputation: 1169
I have found it:
[Test]
[TestCase('TestA', '12,34', ';')] //AValue1 gets '12,34'
procedure ValueShouldHaveComma(const AValue1: string);
The last optional parameter of the TestCase is the separator.
Upvotes: 7