Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
255 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
unit Tests.VariableResolver; | ||
|
||
interface | ||
|
||
uses | ||
TestFramework, | ||
DN.VariableResolver, | ||
DN.VariableResolver.Intf; | ||
|
||
type | ||
TVariableResolverTest = class(TTestCase) | ||
protected | ||
FSut: IVariableResolver; | ||
procedure SetUp; override; | ||
procedure TearDown; override; | ||
published | ||
procedure Create_UnevenVarValueLists_Expect_Exception; | ||
procedure Resolve_ExistingVar_CorrectCase_Expect_Resolved; | ||
procedure Resolve_ExistingVar_DifferentCase_Expect_Resolved; | ||
procedure Resolve_UnknownVar_Expect_Untouched; | ||
procedure Resolve_TextWithoutVars_IncludingIdentifierOfExistingVar_Expect_Untouched; | ||
end; | ||
|
||
implementation | ||
|
||
uses | ||
SysUtils; | ||
|
||
const | ||
CTestInputA = 'Here is some $(FooVar)'; | ||
CTestOutputA = 'Here is some FooVal'; | ||
CTestInputB = 'Here is some $(foovar) for you'; | ||
CTestOutputB = 'Here is some FooVal for you'; | ||
CTestInputC = 'Here is some $(unknown) for you'; | ||
CTestOutputC = CTestInputC; | ||
CTestInputD = 'Here is some FooVar for you'; | ||
CTestOutputD = CTestInputD; | ||
|
||
{ TVariableReplacementTest } | ||
|
||
|
||
procedure TVariableResolverTest.Create_UnevenVarValueLists_Expect_Exception; | ||
begin | ||
ExpectedException := EArgumentException; | ||
FSut := TVariableResolver.Create(['Val'], []); | ||
end; | ||
|
||
procedure TVariableResolverTest.Resolve_ExistingVar_CorrectCase_Expect_Resolved; | ||
begin | ||
CheckEquals(CTestOutputA, FSut.Resolve(CTestInputA)); | ||
end; | ||
|
||
procedure TVariableResolverTest.Resolve_ExistingVar_DifferentCase_Expect_Resolved; | ||
begin | ||
CheckEquals(CTestOutputB, FSut.Resolve(CTestInputB)); | ||
end; | ||
|
||
procedure TVariableResolverTest.Resolve_TextWithoutVars_IncludingIdentifierOfExistingVar_Expect_Untouched; | ||
begin | ||
CheckEquals(CTestOutputD, FSut.Resolve(CTestInputD)); | ||
end; | ||
|
||
procedure TVariableResolverTest.Resolve_UnknownVar_Expect_Untouched; | ||
begin | ||
CheckEquals(CTestOutputC, FSut.Resolve(CTestInputC)); | ||
end; | ||
|
||
procedure TVariableResolverTest.SetUp; | ||
begin | ||
inherited; | ||
FSut := TVariableResolver.Create(['FooVar'], ['FooVal']); | ||
end; | ||
|
||
procedure TVariableResolverTest.TearDown; | ||
begin | ||
inherited; | ||
FSut := nil; | ||
end; | ||
|
||
initialization; | ||
|
||
RegisterTest(TVariableResolverTest.Suite); | ||
|
||
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
program Tests; | ||
{ | ||
Delphi DUnit Test Project | ||
------------------------- | ||
This project contains the DUnit test framework and the GUI/Console test runners. | ||
Add "CONSOLE_TESTRUNNER" to the conditional defines entry in the project options | ||
to use the console test runner. Otherwise the GUI test runner will be used by | ||
default. | ||
} | ||
|
||
{$IFDEF CONSOLE_TESTRUNNER} | ||
{$IFNDEF TESTINSIGHT} | ||
{$APPTYPE CONSOLE} | ||
{$ENDIF} | ||
{$ENDIF} | ||
|
||
uses | ||
TestInsight.DUnit, | ||
Tests.VariableResolver in 'Tests.VariableResolver.pas'; | ||
|
||
{$R *.RES} | ||
|
||
begin | ||
RunRegisteredTests(); | ||
end. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<ProjectGuid>{2526018A-5A5F-4EB7-A812-F0E2AE7A7EB1}</ProjectGuid> | ||
<ProjectVersion>15.4</ProjectVersion> | ||
<FrameworkType>None</FrameworkType> | ||
<Base>True</Base> | ||
<Config Condition="'$(Config)'==''">Debug</Config> | ||
<Platform Condition="'$(Platform)'==''">Win32</Platform> | ||
<TargetedPlatforms>1</TargetedPlatforms> | ||
<AppType>Console</AppType> | ||
<MainSource>Tests.dpr</MainSource> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''"> | ||
<Base>true</Base> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="('$(Platform)'=='OSX32' and '$(Base)'=='true') or '$(Base_OSX32)'!=''"> | ||
<Base_OSX32>true</Base_OSX32> | ||
<CfgParent>Base</CfgParent> | ||
<Base>true</Base> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''"> | ||
<Base_Win32>true</Base_Win32> | ||
<CfgParent>Base</CfgParent> | ||
<Base>true</Base> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''"> | ||
<Base_Win64>true</Base_Win64> | ||
<CfgParent>Base</CfgParent> | ||
<Base>true</Base> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''"> | ||
<Cfg_1>true</Cfg_1> | ||
<CfgParent>Base</CfgParent> | ||
<Base>true</Base> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''"> | ||
<Cfg_1_Win32>true</Cfg_1_Win32> | ||
<CfgParent>Cfg_1</CfgParent> | ||
<Cfg_1>true</Cfg_1> | ||
<Base>true</Base> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''"> | ||
<Cfg_2>true</Cfg_2> | ||
<CfgParent>Base</CfgParent> | ||
<Base>true</Base> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Base)'!=''"> | ||
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys> | ||
<Manifest_File>None</Manifest_File> | ||
<VerInfo_Locale>1031</VerInfo_Locale> | ||
<DCC_UnitSearchPath>$(BDS)\Source\DUnit\src;..;$(DCC_UnitSearchPath)</DCC_UnitSearchPath> | ||
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace> | ||
<DCC_Define>CONSOLE_TESTRUNNER;TESTINSIGHT;$(DCC_Define)</DCC_Define> | ||
<SanitizedProjectName>Tests</SanitizedProjectName> | ||
<DCC_DcuOutput>.</DCC_DcuOutput> | ||
<DCC_ExeOutput>.\$(Platform)\$(Config)</DCC_ExeOutput> | ||
<DCC_E>false</DCC_E> | ||
<DCC_N>false</DCC_N> | ||
<DCC_S>false</DCC_S> | ||
<DCC_F>false</DCC_F> | ||
<DCC_K>false</DCC_K> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Base_OSX32)'!=''"> | ||
<DCC_UsePackage>FireDACASADriver;FireDACSqliteDriver;bindcompfmx;DBXSqliteDriver;FireDACPgDriver;FireDACODBCDriver;RESTBackendComponents;fmx;rtl;dbrtl;DbxClientDriver;IndySystem;FireDACCommon;bindcomp;inetdb;tethering;DBXInterBaseDriver;xmlrtl;DbxCommonDriver;IndyProtocols;dbxcds;DBXMySQLDriver;FireDACCommonDriver;bindcompdbx;soaprtl;bindengine;FMXTee;fmxFireDAC;FireDACADSDriver;CustomIPTransport;FireDAC;dsnap;IndyIPServer;fmxase;IndyCore;IndyIPCommon;CloudService;FireDACIBDriver;FmxTeeUI;inet;fmxobj;FireDACMySQLDriver;soapmidas;soapserver;inetdbxpress;dsnapxml;fmxdae;RESTComponents;FireDACMSAccDriver;dbexpress;IndyIPClient;$(DCC_UsePackage)</DCC_UsePackage> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Base_Win32)'!=''"> | ||
<DCC_UsePackage>FireDACASADriver;FireDACSqliteDriver;bindcompfmx;DBXSqliteDriver;vcldbx;FireDACPgDriver;FireDACODBCDriver;RESTBackendComponents;fmx;rtl;dbrtl;DbxClientDriver;IndySystem;FireDACCommon;bindcomp;inetdb;tethering;TeeDB;inetdbbde;DBXInterBaseDriver;Tee;vclFireDAC;xmlrtl;svnui;DbxCommonDriver;vclimg;IndyProtocols;dbxcds;DBXMySQLDriver;FireDACCommonDriver;MetropolisUILiveTile;bindcompdbx;soaprtl;bindengine;vclactnband;vcldb;vcldsnap;bindcompvcl;FMXTee;TeeUI;vclie;fmxFireDAC;FireDACADSDriver;vcltouch;CustomIPTransport;vclribbon;VclSmp;FireDAC;dsnap;IndyIPServer;VCLRESTComponents;fmxase;vcl;IndyCore;IndyIPCommon;CloudService;dsnapcon;FireDACIBDriver;FmxTeeUI;inet;fmxobj;FireDACMySQLDriver;soapmidas;vclx;soapserver;inetdbxpress;svn;dsnapxml;fmxdae;RESTComponents;bdertl;VirtualTreesR;OmniThreadLibraryRuntimeXE6;FireDACMSAccDriver;dbexpress;adortl;IndyIPClient;$(DCC_UsePackage)</DCC_UsePackage> | ||
<VerInfo_Locale>1033</VerInfo_Locale> | ||
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace> | ||
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Base_Win64)'!=''"> | ||
<DCC_UsePackage>FireDACASADriver;FireDACSqliteDriver;bindcompfmx;DBXSqliteDriver;FireDACPgDriver;FireDACODBCDriver;RESTBackendComponents;fmx;rtl;dbrtl;DbxClientDriver;IndySystem;FireDACCommon;bindcomp;inetdb;tethering;TeeDB;DBXInterBaseDriver;Tee;vclFireDAC;xmlrtl;DbxCommonDriver;vclimg;IndyProtocols;dbxcds;DBXMySQLDriver;FireDACCommonDriver;MetropolisUILiveTile;bindcompdbx;soaprtl;bindengine;vclactnband;vcldb;vcldsnap;bindcompvcl;FMXTee;TeeUI;vclie;fmxFireDAC;FireDACADSDriver;vcltouch;CustomIPTransport;vclribbon;VclSmp;FireDAC;dsnap;IndyIPServer;VCLRESTComponents;fmxase;vcl;IndyCore;IndyIPCommon;CloudService;dsnapcon;FireDACIBDriver;FmxTeeUI;inet;fmxobj;FireDACMySQLDriver;soapmidas;vclx;soapserver;inetdbxpress;dsnapxml;fmxdae;RESTComponents;VirtualTreesR;FireDACMSAccDriver;dbexpress;adortl;IndyIPClient;$(DCC_UsePackage)</DCC_UsePackage> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Cfg_1)'!=''"> | ||
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define> | ||
<DCC_DebugDCUs>true</DCC_DebugDCUs> | ||
<DCC_Optimize>false</DCC_Optimize> | ||
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames> | ||
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe> | ||
<DCC_RemoteDebug>true</DCC_RemoteDebug> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''"> | ||
<VerInfo_Locale>1033</VerInfo_Locale> | ||
<Manifest_File>None</Manifest_File> | ||
<DCC_RemoteDebug>false</DCC_RemoteDebug> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Cfg_2)'!=''"> | ||
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols> | ||
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define> | ||
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo> | ||
<DCC_DebugInformation>0</DCC_DebugInformation> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<DelphiCompile Include="$(MainSource)"> | ||
<MainSource>MainSource</MainSource> | ||
</DelphiCompile> | ||
<DCCReference Include="Tests.VariableResolver.pas"/> | ||
<BuildConfiguration Include="Release"> | ||
<Key>Cfg_2</Key> | ||
<CfgParent>Base</CfgParent> | ||
</BuildConfiguration> | ||
<BuildConfiguration Include="Base"> | ||
<Key>Base</Key> | ||
</BuildConfiguration> | ||
<BuildConfiguration Include="Debug"> | ||
<Key>Cfg_1</Key> | ||
<CfgParent>Base</CfgParent> | ||
</BuildConfiguration> | ||
</ItemGroup> | ||
<ProjectExtensions> | ||
<Borland.Personality>Delphi.Personality.12</Borland.Personality> | ||
<Borland.ProjectType/> | ||
<BorlandProject> | ||
<Delphi.Personality> | ||
<Source> | ||
<Source Name="MainSource">Tests.dpr</Source> | ||
</Source> | ||
<Excluded_Packages> | ||
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k200.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages> | ||
<Excluded_Packages Name="$(BDSBIN)\dclofficexp200.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages> | ||
</Excluded_Packages> | ||
</Delphi.Personality> | ||
<Deployment/> | ||
<Platforms> | ||
<Platform value="OSX32">False</Platform> | ||
<Platform value="Win32">True</Platform> | ||
<Platform value="Win64">False</Platform> | ||
</Platforms> | ||
<UnitTesting> | ||
<TestFramework>DUnit / Delphi Win32</TestFramework> | ||
<TestRunner>Console</TestRunner> | ||
<TestProjectName/> | ||
<SourceProjectName/> | ||
</UnitTesting> | ||
</BorlandProject> | ||
<ProjectFileVersion>12</ProjectFileVersion> | ||
</ProjectExtensions> | ||
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/> | ||
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/> | ||
</Project> |