You are not logged in.
Pages: 1
Hi guys,
We're trying to stub an interface that contains a method that returns an interface. Mormot complains with:
blah : blah parameter should be declared as const
when we try to register the interface.
Looking at the code mormot.pas(54472) we get:
if Kind=mkFunction then
with Args[n] do begin
ParamName := @CONST_PSEUDO_RESULT_NAME;
ValueDirection := smdResult;
SetFromRTTI(PB);
end;
This effectively asks the method to verify the result type as if it were a parameter. But the verification requires an Interface type to be const.
Is this a bug or by design?
Offline
This is as expected, in the current state of the framework.
Interfaces parameters can't be stubbed by the framework, currently.
They are used for asynchronous callbacks, in SOA interface-based services, but not handled yet by TInterfaceStub/TInterfaceMock.
In fact, the mocking feature uses JSON internally for the tracking/validation purposes, so expects the data to be serialized in a stateless representation.
How do you expect to define the class instance returned by the mocked interface?
Define a mocked interface?
Then it won't be representable as JSON anymore.
Offline
Pages: 1