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

Email服务器

开发平台:

Delphi

  1. unit XPDUnitParametersTests;
  2. interface
  3. uses
  4.   TestFrameWork,
  5.   XPDUnitCommon;
  6. type
  7.   TXPDUnitParametersTests = class(TTestCase)
  8.   private
  9.     FParameters: IXPDUnitParameters;
  10.   protected
  11.     procedure SetUp; override;
  12.     procedure TearDown; override;
  13.   published
  14.     // Add test methods here...
  15.     procedure EnumerationLimits;
  16.     procedure Descriptions;
  17.     procedure Identifiers;
  18.     procedure DefaultTemplates;
  19.   end;
  20. implementation
  21. uses
  22.   XPDUnitParameters,
  23.   SysUtils;       // DeleteFile()
  24. { TXPDUnitParametersTests }
  25. procedure TXPDUnitParametersTests.SetUp;
  26. begin
  27.   inherited;
  28.   FParameters := XPDUnitParameters.CreateXPDUnitParameters;
  29. end;
  30. procedure TXPDUnitParametersTests.TearDown;
  31. begin
  32.   FParameters := nil;
  33.   inherited;
  34. end;
  35. procedure TXPDUnitParametersTests.EnumerationLimits;
  36. begin
  37.   Check(System.Low(TXPDUnitParameter) = dpTestedUnitName);
  38.   Check(System.High(TXPDUnitParameter) = dpProjectPath);
  39.   CheckEquals(7, integer(dpProjectPath));
  40. end;
  41. procedure TXPDUnitParametersTests.Descriptions;
  42. begin
  43.   CheckEquals('TestModule unit name.', FParameters.Descriptions(dpUnitName));
  44. end;
  45. procedure TXPDUnitParametersTests.DefaultTemplates;
  46. begin
  47.   SysUtils.DeleteFile(XPDUnitSetupFile);
  48.   CheckEquals('$FILESTEM($CURRENTUNIT)', FParameters.Templates(dpTestedUnitName));
  49.   CheckEquals('$FILESTEM($CURRENTUNIT)Tests', FParameters.Templates(dpUnitName));
  50.   CheckEquals('$FILEPATH($CURRENTUNIT)dunit', FParameters.Templates(dpUnitPath));
  51.   CheckEquals('$TESTEDCLASSNAMETests', FParameters.Templates(dpClassName));
  52.   CheckEquals('$FILESTEM($CURRENTPROJECT)Tests', FParameters.Templates(dpProjectName));
  53.   CheckEquals('$FILEPATH($CURRENTPROJECT)dunit', FParameters.Templates(dpProjectPath));
  54. end;
  55. procedure TXPDUnitParametersTests.Identifiers;
  56. begin
  57.   CheckEquals('UNITNAME', FParameters.Identifiers(dpUnitName));
  58. end;
  59. initialization
  60.   TestFramework.RegisterTest('XPDUnitParametersTests Suite',
  61.     TXPDUnitParametersTests.Suite);
  62. end.