unit Keyman.Test.System.SentryTool.DelphiSearchFile;
{

  Delphi DUnit Test Case
  ----------------------
  This unit contains a skeleton test case class generated by the Test Case Wizard.
  Modify the generated code to correctly setup and call the methods from the unit
  being tested.

}

interface

uses
  TestFramework, Keyman.System.SentryTool.DelphiSearchFile, System.Classes,
  System.SysUtils;

type
  // Test methods for class TDelphiSearchFile

  TestTDelphiSearchFile = class(TTestCase)
  strict private
    FDelphiSearchFile: TDelphiSearchFile;
  public
    procedure SetUp; override;
    procedure TearDown; override;
  published
    procedure TestParseDPR;
  end;

implementation

procedure TestTDelphiSearchFile.SetUp;
begin
  FDelphiSearchFile := TDelphiSearchFile.Create('..\..\..\sentrytool.dpr', '');
end;

procedure TestTDelphiSearchFile.TearDown;
begin
  FDelphiSearchFile.Free;
  FDelphiSearchFile := nil;
end;

procedure TestTDelphiSearchFile.TestParseDPR;
var
  I: Integer;
  u, p: string;
begin
  // TODO: Setup method call parameters
  for I := 0 to FDelphiSearchFile.Files.Count - 1 do
  begin
    u := FDelphiSearchFile.Files.Names[i];
    p := FDelphiSearchFile.Files.ValueFromIndex[i];
    CheckTrue(SameText(u, ChangeFileExt(ExtractFileName(p),'')), 'Unit name '+u+' does not match path '+p);
    CheckTrue(FileExists(p), 'File '+p+' does not exist, suggesting malformed path');
  end;
//  FDelphiSearchFile.Files ParseDPR(AProjectFile);
  // TODO: Validate method results
end;

initialization
  // Register any test cases with the test runner
  RegisterTest(TestTDelphiSearchFile.Suite);
end.

