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

Email服务器

开发平台:

Delphi

  1. unit uTestCheckEmailTread;
  2. interface
  3. uses Classes,uCheckEmailThread,TestFramework;
  4. type
  5.   TTestCheckEmailThread=class(TTestCase)
  6.   private
  7.     FResult:string;
  8.     procedure NewEmail(Sender:TObject;NewEmailUIDLs:TStrings);
  9.   protected
  10.     procedure Setup;override;
  11.     procedure TearDown;override;
  12.   published
  13.     procedure TestCheckEmail;
  14.   end;
  15. implementation
  16. uses uCommon;
  17. { TTestCheckEmailThread }
  18. procedure TTestCheckEmailThread.NewEmail(Sender: TObject;
  19.   NewEmailUIDLs: TStrings);
  20. begin
  21.   FResult:=FResult+NewEmailUIDLs.Text;
  22.   Status(FResult);
  23. end;
  24. procedure TTestCheckEmailThread.Setup;
  25. begin
  26.   FResult:='';
  27. end;
  28. procedure TTestCheckEmailThread.TearDown;
  29. begin
  30.   inherited;
  31. end;
  32. procedure TTestCheckEmailThread.TestCheckEmail;
  33. var
  34.   checker:TCheckEmailThread;
  35.   Acc:TAccounts;
  36.   L:TStrings;
  37. begin
  38.   SetLength(Acc,2);
  39.   Acc[0].Pop3ServerAddr:='pop.21cn.com';
  40.   Acc[0].SeverPort:=110;
  41.   Acc[0].EmailAccount:='linuxpingwp@21cn.com';
  42.   Acc[0].EmailPwd:='123456a';
  43.   {Acc[1].Pop3ServerAddr:='pop.163.com';
  44.   Acc[1].SeverPort:=110;
  45.   Acc[1].EmailAccount:='wangpingdejiejie@163.com';
  46.   Acc[1].EmailPwd:='123456';  }
  47.   L:=TStringList.Create;
  48.   L.Add('xtbBRh0tyUX0KxhvqwAAs5')  ;
  49.   L.Add('100.1.8sg5Y.460k.1235529423.linuxpingwp@21cn.com');
  50.   L.Add('100.1.8sg5Y.460k.1235529423.linuxpingwp@21cn.com');
  51.   checker:=TCheckEmailThread.Create(acc,L);
  52.   L.Free;
  53.   checker.OnNewEmailArrive:=NewEmail;
  54.   checker.Resume;
  55. end;
  56. initialization
  57.   TestFramework.RegisterTest(TTestCheckEmailThread.Suite );
  58. end.