- unit uTestSingnalMgr;
- interface
- uses uSingnalMgr,TestFramework,strutils,sysutils,classes ;
- type
- TTestSingnalMgr=class(TTestCase)
- private
- FIt:TIterator;
- List:TSingnalList;
- protected
- procedure Setup;override;
- procedure TearDown;override;
- published
- procedure TestLoadFromFile;
- procedure TestSaveToFile;
- procedure TestTIteratorFirst;
- procedure TestTIteratorNext;
- procedure TestTIteratorRemove;
- procedure TestTIteratorHasNext;
- procedure PrintList;
- end;
- implementation
- { TTestSingnalMgr }
- procedure TTestSingnalMgr.PrintList;
- var
- S:String;
- P:PSingnalData;
- begin
- S:='';
- while Fit.HasNext do
- begin
- P:=PSingnalData(Fit.next);
- S:=S+'Caption: '+p.Caption+' text:'+strpas(p.Text);
- end;
- Status(S);
- end;
- procedure TTestSingnalMgr.Setup;
- var
- p:PSingnalData;
- begin
- Inherited;
- List:=TSingnalList.create;
- FIt:=TIterator.Create(List);
- P:=List.NewSingnal;
- p.Caption:='cap1';
- p.Text:='text1';
- list.Add(p);
- P:=List.NewSingnal;
- p.Caption:='cap2';
- p.Text:='text2';
- list.Add(p);
- end;
- procedure TTestSingnalMgr.TearDown;
- begin
- FIt.Free;
- List.free;
- Inherited;
- end;
- procedure TTestSingnalMgr.TestLoadFromFile;
- begin
- end;
- procedure TTestSingnalMgr.TestSaveToFile;
- begin
- end;
- procedure TTestSingnalMgr.TestTIteratorFirst;
- begin
- Fit.First;
- end;
- procedure TTestSingnalMgr.TestTIteratorHasNext;
- begin
- status('HasNext:'+booltostr(Fit.HasNext));
- end;
- procedure TTestSingnalMgr.TestTIteratorNext;
- begin
- Status('Caption: '+psingnalData(Fit.Next).Caption+' Text: '+psingnalData(Fit.Next).Text);
- end;
- procedure TTestSingnalMgr.TestTIteratorRemove;
- begin
- Fit.Remove;
- end;
- initialization
- TestFrameWork.RegisterTest(TTestSingnalMgr.Suite);
- end.