#1 2015-04-16 10:56:52

ASiwon
Member
From: Poland
Registered: 2015-01-30
Posts: 82

Help for stubbing needed

Hello,

I have problem with create stub for following code:

  IBkSchenckWazenie1Rozpoznanie = interface(IInvokable)
    ['{F6D047F9-9B3E-4C24-BE1D-5010979318E1}']
    procedure Rozpoznaj(const AWazenie: TSchenckWMWazenie1; out ARodzaj: Integer; out APotwierdz, APosrednie: Boolean);
  end;

  TSchenckWMWazenie1 = class(TSQLRecord)
  private
    FSklad: String;
  published
    property Sklad: String index 30 read FSklad write FSklad;
       // Other properties ...
    ...
  end;

procedure Test_Something;
var
  wazenie: TSchenckWMWazenie1;
  FWazenieRozpoznanie: IBkSchenckWazenie1Rozpoznanie;
  rodzaj: Integer;
  potwierdz, posrednie: Boolean;
begin
  wazenie := TSchenckWMWazenie1.Create;
  try
    wazenie.Sklad := cSklad;
      // Some other assignment...
    TInterfaceStub.Create(IBkSchenckWazenie1Rozpoznanie, FWazenieRozpoznanie);
      Returns('Rozpoznaj', [ObjectToJSON(wazenie, []), rodzaj, potwierdz, posrednie], [cArticleWeight, False, False]);
    FWazenieRozpoznanie.Rozpoznaj(wazenie, rodzaj, potwierdz, posrednie);
      // Here value in rodzaj is always 0
    ...
  finally
    wazenie.Free;
  end;
end;

Value returned in parameter rodzaj is always 0, but cArticleWeight has value 1.

I have tried to create stub in this way:

    TInterfaceStub.Create(IBkSchenckWazenie1Rozpoznanie, FWazenieRozpoznanie);
      Returns('Rozpoznaj', [ObjectToJSON(wazenie, [])], [cArticleWeight, False, False]);

But nothing is changed. What I'm doing wrong?

Last edited by ASiwon (2015-04-16 11:00:53)


best regards
Adam Siwon

Offline

#2 2015-04-16 20:22:16

ASiwon
Member
From: Poland
Registered: 2015-01-30
Posts: 82

Re: Help for stubbing needed

I have changed code to the following kind:

TInterfaceStub.Create(IBkSchenckWazenie1Rozpoznanie, FWazenieRozpoznanie).
      Returns('Rozpoznaj', [wazenie], [cArticleWeight, False, False]);

and now is working as expected. :-)


best regards
Adam Siwon

Offline

Board footer

Powered by FluxBB