uTestCheckEmail.pas
上传用户:yjb1804
上传日期:2021-01-30
资源大小:3105k
文件大小:2k
- unit uTestCheckEmail;
- interface
- uses Classes,uCheckEmail,TestFramework,Windows;
- type
- TTestCheckEmail=class(TTestCase)
- private
- ce:TCheckEmail;
- procedure Setup;override;
- procedure TearDown;override;
- procedure OnNewEmail(Sender:TObject;NewEmailUIDLs:TStrings) ;
- published
- procedure TestCheckEmail_EnterStateAsMin;
- procedure TestCheckEmail_EnterStateAsRestore;
- procedure TestCheckEmail_EnterStateAsInit;
- procedure TestCheckEmail_EnterState;
- procedure TestCreateThenFree;
- end;
- implementation
- uses uMyXml, uCommon;
- { TTestCheckEmailThread }
- procedure TTestCheckEmail.OnNewEmail(Sender: TObject;
- NewEmailUIDLs: TStrings);
- begin
- WriteLog('TTestCheckEmailThread.NewEmailUIDLs:'+NewEmailUIDLs.Text);
- end;
- procedure TTestCheckEmail.Setup;
- var
- xml:TAppXml;
- begin
- ce:=TCheckEmail.Create;
- ce.OnNewEmailArrive:=OnNewEmail;
- xml:=TAppXml.Create;
- try
- xml.GetUIDLS(ce.OldUIDLs);
- finally
- xml.Free;
- end;
- end;
- procedure TTestCheckEmail.TearDown;
- begin
-
- //Ce.free;
- end;
- procedure TTestCheckEmail.TestCheckEmail_EnterState;
- begin
- ce.EnterState(asInit);
- ce.EnterState(asMin);
- ce.EnterState(asRestore);
- sleep(8500);
- end;
- procedure TTestCheckEmail.TestCheckEmail_EnterStateAsInit;
- begin
- ce.EnterState(asInit);
- end;
- procedure TTestCheckEmail.TestCheckEmail_EnterStateAsMin;
- begin
- ce.EnterState(asMin);
- end;
- procedure TTestCheckEmail.TestCheckEmail_EnterStateAsRestore;
- begin
- ce.EnterState(asRestore);
- end;
- procedure TTestCheckEmail.TestCreateThenFree;
- var
- cet:TCheckEmail;
- xml:TAppXml;
- begin
- cet:=TCheckEmail.Create;
- cet.OnNewEmailArrive:=OnNewEmail;
- xml:=TAppXml.Create;
- try
- xml.GetUIDLS(cet.OldUIDLs);
- finally
- xml.Free;
- end;
- Sleep(10000);
- cet.free;
- end;
- initialization
- TestFramework.RegisterTest(TTestCheckEmail.Suite );
- end.