I\'m trying to check the state of an object after running a test. This state is contained in a set. Is it possible to pass the expected state to the test case using DUnitX Attri
Add this conversion function to DUnitX.Utils
and put it into the Conversions matrix for tkUString
to tkSet
(due to limitations of StringToSet
and TValue
this only works for sets up to 32 elements, for larger sets of up to 256 elements there is more code required though):
function ConvStr2Set(const ASource: TValue; ATarget: PTypeInfo; out AResult: TValue): Boolean;
begin
TValue.Make(StringToSet(ATarget, ASource.AsString), ATarget, AResult);
Result := True;
end;
Also you need to use a different separator char for the parameters or it will split them wrong:
[TestCase('Demo1','InputA;[resWarn,resError]', ';')]