delphi-mocks

Returning records in Delphi-Mocks

眉间皱痕 提交于 2021-01-28 17:35:32
问题 I would like to, using Delphi-Mocks, mock a class with a function returning a record. TValue and my record are reported as incompatible types. Is there any way I can do this with WillExecute or any other way? 回答1: Found out: myMock.Setup.WillReturnDefault('function_name', TValue.From(rec_variable)); 来源: https://stackoverflow.com/questions/34987688/returning-records-in-delphi-mocks

Mocking interfaces in DUnit with Delphi-Mocks and Spring4D

自古美人都是妖i 提交于 2020-01-05 07:42:12
问题 So, I am getting Access Violation error when try to Mock 2-nd composite interface, below examples of code with using Delphi-Mocks and Spring4D frameworks unit u_DB; type TDBObject = class public property ID: TGUID; end; TDBCRM = class(TDBObject) public property SOME_FIELD: TSomeType; end; unit i_dmServer; type {$M+} IdmServer = interface ['{A4475441-9651-4956-8310-16FB710EAE5E}'] function GetServiceConnection: TServiceConnection; function GetCurrentUser(): TUser; end; unit d_ServerWrapper;