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

Email服务器

开发平台:

Delphi

  1. unit uTestCheckEmail;
  2. interface
  3. uses Classes,uCheckEmail,TestFramework,Windows;
  4. type
  5.   TTestCheckEmail=class(TTestCase)
  6.   private
  7.     ce:TCheckEmail;
  8.     procedure Setup;override;
  9.     procedure TearDown;override;
  10.     procedure OnNewEmail(Sender:TObject;NewEmailUIDLs:TStrings) ;
  11.   published
  12.     procedure TestCheckEmail_EnterStateAsMin;
  13.     procedure TestCheckEmail_EnterStateAsRestore;
  14.     procedure TestCheckEmail_EnterStateAsInit;
  15.     procedure TestCheckEmail_EnterState;
  16.     procedure TestCreateThenFree;
  17.   end;
  18. implementation
  19. uses uMyXml, uCommon;
  20. { TTestCheckEmailThread }
  21. procedure TTestCheckEmail.OnNewEmail(Sender: TObject;
  22.   NewEmailUIDLs: TStrings);
  23. begin
  24.   WriteLog('TTestCheckEmailThread.NewEmailUIDLs:'+NewEmailUIDLs.Text);
  25. end;
  26. procedure TTestCheckEmail.Setup;
  27. var
  28.   xml:TAppXml;
  29. begin
  30.   ce:=TCheckEmail.Create;
  31.   ce.OnNewEmailArrive:=OnNewEmail;
  32.   xml:=TAppXml.Create;
  33.   try
  34.     xml.GetUIDLS(ce.OldUIDLs);
  35.   finally
  36.     xml.Free;
  37.   end;
  38. end;
  39. procedure TTestCheckEmail.TearDown;
  40. begin
  41.  
  42.   //Ce.free;
  43. end;
  44. procedure TTestCheckEmail.TestCheckEmail_EnterState;
  45. begin
  46.    ce.EnterState(asInit);
  47.    ce.EnterState(asMin);
  48.    ce.EnterState(asRestore);
  49.    sleep(8500);
  50. end;
  51. procedure TTestCheckEmail.TestCheckEmail_EnterStateAsInit;
  52. begin
  53.    ce.EnterState(asInit);
  54. end;
  55. procedure TTestCheckEmail.TestCheckEmail_EnterStateAsMin;
  56. begin
  57.   ce.EnterState(asMin);
  58. end;
  59. procedure TTestCheckEmail.TestCheckEmail_EnterStateAsRestore;
  60. begin
  61.   ce.EnterState(asRestore);
  62. end;
  63. procedure TTestCheckEmail.TestCreateThenFree;
  64. var
  65.   cet:TCheckEmail;
  66.   xml:TAppXml;
  67. begin
  68.   cet:=TCheckEmail.Create;
  69.   cet.OnNewEmailArrive:=OnNewEmail;
  70.   xml:=TAppXml.Create;
  71.   try
  72.     xml.GetUIDLS(cet.OldUIDLs);
  73.   finally
  74.     xml.Free;
  75.   end;
  76.   Sleep(10000);
  77.   cet.free;
  78. end;
  79. initialization
  80.   TestFramework.RegisterTest(TTestCheckEmail.Suite );
  81. end.