Invalid Cast when using Arg.IsAny with "set of"

Issue #324 resolved
Stefan Glienke repo owner created an issue

Following code raises an EInvalidCast exception:

uses
  Spring.Mocking;

type
  TColor = (cRed, cGreen, cBlue);
  TColors = set of TColor;

  ITest = interface(IInvokable)
    ['{5987F1A0-7982-4439-9442-E42E355229AE}']
    procedure Run(AValue: TColors);
  end;

var
  LMock: Mock<ITest>;
begin
  LMock.Setup.Executes().When.Run(Arg.IsAny<TColors>);
  LMock.Instance.Run([]);
  LMock.Received.Run(Arg.IsAny<TColors>);
end.

Comments (3)

  1. Log in to comment