Unit1Test.pas
上传用户:yjb1804
上传日期:2021-01-30
资源大小:3105k
文件大小:1k
源码类别:

Email服务器

开发平台:

Delphi

  1. unit Unit1Test;
  2. interface
  3. uses
  4.   TestFramework, Unit1;
  5. type
  6.   TTestMyObject = class(TTestCase)
  7.   private
  8.     FMyObject: TMyObject;
  9.   public
  10.     procedure Setup; override;
  11.     procedure TearDown; override;
  12.   published
  13.     procedure testMyObject;
  14.   end;
  15. implementation
  16. { TTestMyObject }
  17. procedure TTestMyObject.Setup;
  18. begin
  19.   FMyObject := TMyObject.Create;
  20. end;
  21. procedure TTestMyObject.TearDown;
  22. begin
  23.   FMyObject.Free;
  24. end;
  25. procedure TTestMyObject.testMyObject;
  26. begin
  27.   try
  28.     FMyObject.DoSomething;
  29.   except
  30.     check(false);
  31.   end;
  32. end;
  33. initialization
  34.   RegisterTest('', TTestMyObject.Suite);
  35. end.