7

私は次の.dprを持っています

program TPWDDBManager;
{

  Delphi DUnit Test Project
  -------------------------
  This project contains the DUnit test framework and the GUI/Console test runners.
  Add "CONSOLE_TESTRUNNER" to the conditional defines entry in the project options
  to use the console test runner.  Otherwise the GUI test runner will be used by
  default.

}

{$IFDEF CONSOLE_TESTRUNNER}
{$APPTYPE CONSOLE}
{$ENDIF}

uses
  DUnitTestRunner,
  TestuTPWDDBManager in 'TestuTPWDDBManager.pas';

{$R *.RES}

begin
  DUnitTestRunner.RunRegisteredTests;
end.

そして次のユニット:

unit TestuTPWDDBManager;
{

  Delphi DUnit Test Case
  ----------------------
  This unit contains a skeleton test case class generated by the Test Case Wizard.
  Modify the generated code to correctly setup and call the methods from the unit
  being tested.

}

interface

uses TestFramework;

type
  // Test methods for class TPWDDBManager

  TestTPWDDBManager = class(TTestCase)
  strict private
  public
    procedure SetUp; override;
    procedure TearDown; override;
  published
    procedure TestUpdateVersion;
    procedure TestGetPWD;
    procedure TestChangePWD;
    procedure TestReset;
    procedure TestIsReset;

  end;

  Idlg = interface(IInvokable)
    ['{E369D075-E3CA-4BB3-896C-0D623DE5798F}']

  end;

implementation

uses SysUtils,Delphi.Mocks;

procedure TestTPWDDBManager.SetUp;
var
  FMessageDLG : TMock<IDlg>;
begin
end;

procedure TestTPWDDBManager.TearDown;
begin
end;

procedure TestTPWDDBManager.TestGetPWD;
begin
  // TODO: Validate method results
end;

procedure TestTPWDDBManager.TestIsReset;
begin
end;

procedure TestTPWDDBManager.TestChangePWD;
begin
end;

procedure TestTPWDDBManager.TestReset;
begin
end;

procedure TestTPWDDBManager.TestUpdateVersion;
begin

end;

initialization
  // Register any test cases with the test runner
  RegisterTest(TestTPWDDBManager.Suite);
end.

コンパイルすると、次のようないくつかの警告が表示されます。

[DCC 警告] W1029 同一のパラメーターを持つ重複したコンストラクター 'TExpectation.CreateAfter' は、C++ からアクセスできません [DCC 警告] W1029 同一のパラメーターを持つ重複したコンストラクター 'TExpectation.CreateAfterWhen' は、C++ からアクセスできません [DCC 警告] W1029 CreateAtLeastOnce' に同一のパラメーターを指定すると、C++ からアクセスできなくなります。

しかし、行を削除するとFMessageDLG : TMock<IDlg>;警告が消えます

これを解決する方法はありますか?

4

2 に答える 2

4

警告は、それが言うことを正確に意味します。C++ の互換性に関心がない場合は、単純に警告を無効にしてください。それ以外の場合は、TExpectation の定義を変更して、名前だけでなくパラメーター リストが異なるコンストラクターを指定する必要があります。

于 2013-11-10T13:14:53.503 に答える