Commits

Nick Hodges committed 9a9c500

Adding the Powerpoint slides

Comments (0)

Files changed (36)

 (?i)\.cbk
 (?i)\.ovr
 (?i)\.dcr
-(?i)\.pptx
 (?i)\.docx
 syntax: glob
 */_ReSharper.*

Denmark/1 - Interfaces/Using Interfaces.pptx

Binary file added.

Denmark/2 - Generics/Generics.pptx

Binary file added.

Denmark/3 - Anonymous Methods/Anonymous Methods.pptx

Binary file added.

Denmark/3 - Anonymous Methods/Code/MiscellaneousAnonymousMethodsDemos.dpr

 uses
   System.SysUtils,
   uAnonymousMethodUtils in 'uAnonymousMethodUtils.pas',
-  uBenchmarkPowerFunctions in 'uBenchmarkPowerFunctions.pas',
+  uBenchmarkDemos in 'uBenchmarkDemos.pas',
   uUsingDemo in 'uUsingDemo.pas';
 
 begin
   try
-    RunBenchmark;
+ //   RunBenchmark;
     UsingDemo;
   except
     on E: Exception do

Denmark/3 - Anonymous Methods/Code/MiscellaneousAnonymousMethodsDemos.dproj

 				<MainSource>MainSource</MainSource>
 			</DelphiCompile>
 			<DCCReference Include="uAnonymousMethodUtils.pas"/>
-			<DCCReference Include="uBenchmarkPowerFunctions.pas"/>
+			<DCCReference Include="uBenchmarkDemos.pas"/>
 			<DCCReference Include="uUsingDemo.pas"/>
 			<BuildConfiguration Include="Release">
 				<Key>Cfg_2</Key>

Denmark/3 - Anonymous Methods/Code/uBenchmarkDemos.pas

+unit uBenchmarkDemos;
+
+interface
+
+procedure RunBenchmark;
+
+implementation
+
+uses
+       uAnonymousMethodUtils
+     , SysUtils
+     ;
+
+type
+  ISomeInterface = interface
+    procedure IntfCall(const Intf: ISomeInterface; depth: Integer);
+  end;
+
+  TSomeClass = class(TInterfacedObject, ISomeInterface)
+  public
+    procedure VirtCall(Inst: TSomeClass; depth: Integer); virtual;
+    procedure StaticCall(Inst: TSomeClass; depth: Integer);
+    procedure IntfCall(const Intf: ISomeInterface; depth: Integer);
+  end;
+
+{ TSomeClass }
+
+procedure TSomeClass.IntfCall(const Intf: ISomeInterface; depth: Integer);
+begin
+  if depth > 0 then
+    Intf.IntfCall(Intf, depth - 1);
+end;
+
+procedure TSomeClass.StaticCall(Inst: TSomeClass; depth: Integer);
+begin
+  if depth > 0 then
+    StaticCall(Inst, depth - 1);
+end;
+
+procedure TSomeClass.VirtCall(Inst: TSomeClass; depth: Integer);
+begin
+  if depth > 0 then
+    VirtCall(Inst, depth - 1);
+end;
+
+procedure RunBenchmark;
+const
+  CallDepth = 10000;
+var
+  b: TBenchmarker;
+  x: TSomeClass;
+  intf: ISomeInterface;
+begin
+  b := TBenchmarker.Create(procedure(Name: string; Time: Double)
+  begin
+    Writeln(Format('%-20s took %15.9f ms', [Name, Time * 1000]));
+  end);
+  try
+    b.Warmups := 100;
+    b.Iterations := 5000;
+
+    x := TSomeClass.Create;
+    intf := x;
+
+    b.Benchmark('Static call', procedure
+    begin
+      x.StaticCall(x, CallDepth);
+    end);
+
+    b.Benchmark('Virtual call', procedure
+    begin
+      x.VirtCall(x, CallDepth);
+    end);
+
+    b.Benchmark('Interface call', procedure
+    begin
+      intf.IntfCall(intf, CallDepth);
+    end);
+
+  finally
+    b.Free;
+  end;
+end;
+
+
+end.

Denmark/3 - Anonymous Methods/Code/uBenchmarkPowerFunctions.pas

-unit uBenchmarkPowerFunctions;
-
-interface
-
-procedure RunBenchmark;
-
-implementation
-
-uses
-       uAnonymousMethodUtils
-     , SysUtils
-     ;
-
-type
-  ISomeInterface = interface
-    procedure IntfCall(const Intf: ISomeInterface; depth: Integer);
-  end;
-
-  TSomeClass = class(TInterfacedObject, ISomeInterface)
-  public
-    procedure VirtCall(Inst: TSomeClass; depth: Integer); virtual;
-    procedure StaticCall(Inst: TSomeClass; depth: Integer);
-    procedure IntfCall(const Intf: ISomeInterface; depth: Integer);
-  end;
-
-{ TSomeClass }
-
-procedure TSomeClass.IntfCall(const Intf: ISomeInterface; depth: Integer);
-begin
-  if depth > 0 then
-    Intf.IntfCall(Intf, depth - 1);
-end;
-
-procedure TSomeClass.StaticCall(Inst: TSomeClass; depth: Integer);
-begin
-  if depth > 0 then
-    StaticCall(Inst, depth - 1);
-end;
-
-procedure TSomeClass.VirtCall(Inst: TSomeClass; depth: Integer);
-begin
-  if depth > 0 then
-    VirtCall(Inst, depth - 1);
-end;
-
-procedure RunBenchmark;
-const
-  CallDepth = 10000;
-var
-  b: TBenchmarker;
-  x: TSomeClass;
-  intf: ISomeInterface;
-begin
-  b := TBenchmarker.Create(procedure(Name: string; Time: Double)
-  begin
-    Writeln(Format('%-20s took %15.9f ms', [Name, Time * 1000]));
-  end);
-  try
-    b.Warmups := 100;
-    b.Iterations := 100;
-
-    x := TSomeClass.Create;
-    intf := x;
-
-    b.Benchmark('Static call', procedure
-    begin
-      x.StaticCall(x, CallDepth);
-    end);
-
-    b.Benchmark('Virtual call', procedure
-    begin
-      x.VirtCall(x, CallDepth);
-    end);
-
-    b.Benchmark('Interface call', procedure
-    begin
-      intf.IntfCall(intf, CallDepth);
-    end);
-
-  finally
-    b.Free;
-  end;
-end;
-
-
-end.

Denmark/5 - IEnumerable/IEnumerable.pptx

Binary file added.

Denmark/6 - Predicates/Predicates.pptx

Binary file added.

Denmark/7 - Dependency Injection/Code/StepByStep/5-IsolateInterfaces/uDoOrderProcessing.pas

 implementation
 
 uses
-     uOrder
+       uOrder
      , uOrderInterfaces
      , uOrderValidator
      , uOrderEntry

Denmark/7 - Dependency Injection/Code/StepByStep/7-CustomConstructor/uDoOrderProcessing.pas

 uses
         uOrder
       , uOrderInterfaces
-   //   , uOrderValidator
-   //   , uOrderEntry
-    //  , uOrderProcessor
       , Spring.Services
       ;
 

Denmark/7 - Dependency Injection/Dependency Injection with Delphi and the Spring Framework.pptx

Binary file added.

Denmark/7 - Dependency Injection/Unit Testing with Delphi.pptx

Binary file added.

Denmark/8 - Unit Testing/Code/Calculator/CalculatorTestUnit.pas

 begin
   TestResult := AddNumbers(2, 3);
   ExpectedResult := 5;
-  CheckEquals(ExpectedResult, TestResult);
-
+  CheckEquals(ExpectedResult, TestResult, 'If this is not five, then we have a serious problem');
 
   TestResult := AddNumbers(-1, 3);
   ExpectedResult := 2;
   ExpectedResult := -13;
   CheckEquals(ExpectedResult, TestResult);
 
+  TestResult := AddNumbers(0, 0);
+  ExpectedResult := 0;
+  CheckEquals(ExpectedResult, TestResult);
+
 end;
 
 
   TempCalc.PressEquals;
   Result := TempCalc.Display;
 end;
-//
+
+
+
 function CreateSubtractionCalculations: TCalculations;
 begin
   Result := TCalculations.Create(
     TCalculatorRecord.Create(0, 2, -2),
     TCalculatorRecord.Create(0, -1, 1),
     TCalculatorRecord.Create(2234, 2, 2232),
+    TCalculatorRecord.Create(1, 1, 0),
     TCalculatorRecord.Create(-1, -2, 1),
     TCalculatorRecord.Create(-1, -3, 2));
+
 end;
-//
+
 procedure TestTCalculator.TestSubtraction;
 var
   i: integer;
   CDates := CreateSubtractionCalculations;
   for i := Low(CDates) to High(CDates) do
   begin
+    //Arrange
     TempCalc.Clear;
     Expected := CDates[i].Result;
+    //Act
     TestResult := SubtractNumbers(CDates[i].A, CDates[i].B);
+    //Assert
     CheckEquals(Expected, TestResult, Format('You idiot, cant''t you subtract??? -- Failed for %d and %d', [CDates[i].A, CDates[i].B]));
   end;
 end;

Denmark/8 - Unit Testing/Code/Calculator/Debug/Win32/dunit.ini

 [GUITestRunner Config]
 AutoSave=1
-Left=108
-Top=174
+Left=325
+Top=213
 Width=1001
 Height=504
 Maximized=0

Denmark/8 - Unit Testing/Code/Calculator/uCalculator.pas

   FOperation := coSubtraction;
 end;
 
-
-
 procedure TCalculator.SetDisplay(const Value: integer);
 begin
   FDisplay := Value;

Denmark/8 - Unit Testing/Code/CalculatorFromScrath/CalculatorFromScratchProjectGroup.groupproj

+	<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+		<PropertyGroup>
+			<ProjectGuid>{FE9B6512-FE42-4AE2-99FA-59CB36BE13B8}</ProjectGuid>
+		</PropertyGroup>
+		<ItemGroup>
+			<Projects Include="CalculatorProject.dproj">
+				<Dependencies/>
+			</Projects>
+			<Projects Include="Test\CalculatorProjectTests.dproj">
+				<Dependencies/>
+			</Projects>
+		</ItemGroup>
+		<ProjectExtensions>
+			<Borland.Personality>Default.Personality.12</Borland.Personality>
+			<Borland.ProjectType/>
+			<BorlandProject>
+				<Default.Personality/>
+			</BorlandProject>
+		</ProjectExtensions>
+		<Target Name="CalculatorProject">
+			<MSBuild Projects="CalculatorProject.dproj"/>
+		</Target>
+		<Target Name="CalculatorProject:Clean">
+			<MSBuild Projects="CalculatorProject.dproj" Targets="Clean"/>
+		</Target>
+		<Target Name="CalculatorProject:Make">
+			<MSBuild Projects="CalculatorProject.dproj" Targets="Make"/>
+		</Target>
+		<Target Name="CalculatorProjectTests">
+			<MSBuild Projects="Test\CalculatorProjectTests.dproj"/>
+		</Target>
+		<Target Name="CalculatorProjectTests:Clean">
+			<MSBuild Projects="Test\CalculatorProjectTests.dproj" Targets="Clean"/>
+		</Target>
+		<Target Name="CalculatorProjectTests:Make">
+			<MSBuild Projects="Test\CalculatorProjectTests.dproj" Targets="Make"/>
+		</Target>
+		<Target Name="Build">
+			<CallTarget Targets="CalculatorProject;CalculatorProjectTests"/>
+		</Target>
+		<Target Name="Clean">
+			<CallTarget Targets="CalculatorProject:Clean;CalculatorProjectTests:Clean"/>
+		</Target>
+		<Target Name="Make">
+			<CallTarget Targets="CalculatorProject:Make;CalculatorProjectTests:Make"/>
+		</Target>
+		<Import Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')" Project="$(BDS)\Bin\CodeGear.Group.Targets"/>
+	</Project>

Denmark/8 - Unit Testing/Code/CalculatorFromScrath/CalculatorProject.dpr

+program CalculatorProject;
+
+{$APPTYPE CONSOLE}
+
+{$R *.res}
+
+uses
+  System.SysUtils,
+  uCalculator in 'uCalculator.pas';
+
+begin
+  try
+    { TODO -oUser -cConsole Main : Insert code here }
+  except
+    on E: Exception do
+      Writeln(E.ClassName, ': ', E.Message);
+  end;
+end.

Denmark/8 - Unit Testing/Code/CalculatorFromScrath/CalculatorProject.dproj

+	<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+		<PropertyGroup>
+			<ProjectGuid>{7F94CA10-CFA2-4D1F-9AF4-54FF84852AAD}</ProjectGuid>
+			<ProjectVersion>13.4</ProjectVersion>
+			<FrameworkType>None</FrameworkType>
+			<MainSource>CalculatorProject.dpr</MainSource>
+			<Base>True</Base>
+			<Config Condition="'$(Config)'==''">Debug</Config>
+			<Platform Condition="'$(Platform)'==''">Win32</Platform>
+			<TargetedPlatforms>1</TargetedPlatforms>
+			<AppType>Console</AppType>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
+			<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="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
+			<Base_Win32>true</Base_Win32>
+			<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)'!=''">
+			<DCC_UsePackage>bindcompfmx;fmx;rtl;dbrtl;IndySystem;DbxClientDriver;bindcomp;inetdb;DBXInterBaseDriver;DataSnapCommon;DataSnapClient;DataSnapServer;DataSnapProviderClient;xmlrtl;DbxCommonDriver;IndyProtocols;DBXMySQLDriver;dbxcds;soaprtl;bindengine;DBXOracleDriver;CustomIPTransport;dsnap;DBXInformixDriver;fmxase;IndyCore;DBXFirebirdDriver;inet;fmxobj;inetdbxpress;DBXSybaseASADriver;fmxdae;IPIndyImpl;dbexpress;DataSnapIndy10ServerTransport;$(DCC_UsePackage)</DCC_UsePackage>
+			<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
+			<DCC_DcuOutput>.\$(Platform)\$(Config)</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_Win64)'!=''">
+			<DCC_UsePackage>DBXOdbcDriver;DBXSybaseASEDriver;vclimg;vclactnband;vcldb;bindcompvcl;vcldsnap;vclie;vcltouch;DBXDb2Driver;websnap;VclSmp;vcl;DBXMSSQLDriver;dsnapcon;vclx;webdsnap;$(DCC_UsePackage)</DCC_UsePackage>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Base_Win32)'!=''">
+			<DCC_UsePackage>vcldbx;frx16;TeeDB;Rave100VCL;vclib;Tee;inetdbbde;DBXOdbcDriver;DBXSybaseASEDriver;ibxpress;svnui;vclimg;fmi;intrawebdb_120_160;frxDB16;fs16;vclactnband;FMXTee;TeeUI;vcldb;bindcompvcl;vcldsnap;vclie;vcltouch;Intraweb_120_160;DBXDb2Driver;websnap;vclribbon;VclSmp;fsDB16;frxe16;vcl;DataSnapConnectors;CloudService;DBXMSSQLDriver;CodeSiteExpressPkg;FmxTeeUI;dsnapcon;vclx;webdsnap;svn;bdertl;adortl;$(DCC_UsePackage)</DCC_UsePackage>
+			<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
+			<VerInfo_Locale>1033</VerInfo_Locale>
+			<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="'$(Cfg_1)'!=''">
+			<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
+			<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)'!=''">
+			<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>false</DCC_DebugInformation>
+		</PropertyGroup>
+		<ItemGroup>
+			<DelphiCompile Include="$(MainSource)">
+				<MainSource>MainSource</MainSource>
+			</DelphiCompile>
+			<DCCReference Include="uCalculator.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>
+					<VersionInfo>
+						<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
+						<VersionInfo Name="AutoIncBuild">False</VersionInfo>
+						<VersionInfo Name="MajorVer">1</VersionInfo>
+						<VersionInfo Name="MinorVer">0</VersionInfo>
+						<VersionInfo Name="Release">0</VersionInfo>
+						<VersionInfo Name="Build">0</VersionInfo>
+						<VersionInfo Name="Debug">False</VersionInfo>
+						<VersionInfo Name="PreRelease">False</VersionInfo>
+						<VersionInfo Name="Special">False</VersionInfo>
+						<VersionInfo Name="Private">False</VersionInfo>
+						<VersionInfo Name="DLL">False</VersionInfo>
+						<VersionInfo Name="Locale">1033</VersionInfo>
+						<VersionInfo Name="CodePage">1252</VersionInfo>
+					</VersionInfo>
+					<VersionInfoKeys>
+						<VersionInfoKeys Name="CompanyName"/>
+						<VersionInfoKeys Name="FileDescription"/>
+						<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
+						<VersionInfoKeys Name="InternalName"/>
+						<VersionInfoKeys Name="LegalCopyright"/>
+						<VersionInfoKeys Name="LegalTrademarks"/>
+						<VersionInfoKeys Name="OriginalFilename"/>
+						<VersionInfoKeys Name="ProductName"/>
+						<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
+						<VersionInfoKeys Name="Comments"/>
+					</VersionInfoKeys>
+					<Source>
+						<Source Name="MainSource">CalculatorProject.dpr</Source>
+					</Source>
+				</Delphi.Personality>
+				<Deployment/>
+				<Platforms>
+					<Platform value="Win64">False</Platform>
+					<Platform value="OSX32">False</Platform>
+					<Platform value="Win32">True</Platform>
+				</Platforms>
+				<UnitTesting>
+					<TestProjectName>C:\Code\NickDemoCode\Denmark\8 - Unit Testing\Code\CalculatorFromScrath\Test\CalculatorProjectTests.dproj</TestProjectName>
+				</UnitTesting>
+			</BorlandProject>
+			<ProjectFileVersion>12</ProjectFileVersion>
+		</ProjectExtensions>
+		<Import Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')" Project="$(BDS)\Bin\CodeGear.Delphi.Targets"/>
+		<Import Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')" Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj"/>
+	</Project>

Denmark/8 - Unit Testing/Code/CalculatorFromScrath/Test/CalculatorProjectTests.dpr

+program CalculatorProjectTests;
+{
+
+  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}
+{$APPTYPE CONSOLE}
+{$ENDIF}
+
+uses
+  TestuCalculator in 'TestuCalculator.pas',
+  uCalculator in '..\uCalculator.pas';
+
+ususes
+  DUnitTestRunner,
+  TestuCalculator in 'TestuCalculator.pas';
+
+R *.RES}
+
+begin
+  DUnitTestRunner.RunRegisteredTests;
+end.
+

Denmark/8 - Unit Testing/Code/CalculatorFromScrath/Test/CalculatorProjectTests.dproj

+	<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+		<PropertyGroup>
+			<ProjectGuid>{B6005D8F-85CE-49C5-9801-136DE27E9E56}</ProjectGuid>
+			<ProjectVersion>13.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>CalculatorProjectTests.dpr</MainSource>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
+			<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="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
+			<Base_Win32>true</Base_Win32>
+			<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)'!=''">
+			<DCC_UnitSearchPath>$(BDS)\Source\DUnit\src;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
+			<DCC_UsePackage>bindcompfmx;fmx;rtl;dbrtl;IndySystem;DbxClientDriver;bindcomp;inetdb;DBXInterBaseDriver;DataSnapCommon;DataSnapClient;DataSnapServer;DataSnapProviderClient;xmlrtl;DbxCommonDriver;IndyProtocols;DBXMySQLDriver;dbxcds;soaprtl;bindengine;DBXOracleDriver;CustomIPTransport;dsnap;DBXInformixDriver;fmxase;IndyCore;DBXFirebirdDriver;inet;fmxobj;inetdbxpress;DBXSybaseASADriver;fmxdae;IPIndyImpl;dbexpress;DataSnapIndy10ServerTransport;$(DCC_UsePackage)</DCC_UsePackage>
+			<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;$(DCC_Define)</DCC_Define>
+			<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_Win64)'!=''">
+			<DCC_UsePackage>DBXOdbcDriver;DBXSybaseASEDriver;vclimg;vclactnband;vcldb;bindcompvcl;vcldsnap;vclie;vcltouch;DBXDb2Driver;websnap;VclSmp;vcl;DBXMSSQLDriver;dsnapcon;vclx;webdsnap;$(DCC_UsePackage)</DCC_UsePackage>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Base_Win32)'!=''">
+			<DCC_UsePackage>vcldbx;frx16;TeeDB;Rave100VCL;vclib;Tee;inetdbbde;DBXOdbcDriver;DBXSybaseASEDriver;ibxpress;svnui;vclimg;fmi;intrawebdb_120_160;frxDB16;fs16;vclactnband;FMXTee;TeeUI;vcldb;bindcompvcl;vcldsnap;vclie;vcltouch;Intraweb_120_160;DBXDb2Driver;websnap;vclribbon;VclSmp;fsDB16;frxe16;vcl;DataSnapConnectors;CloudService;DBXMSSQLDriver;CodeSiteExpressPkg;FmxTeeUI;dsnapcon;vclx;webdsnap;svn;bdertl;adortl;$(DCC_UsePackage)</DCC_UsePackage>
+			<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
+			<VerInfo_Locale>1033</VerInfo_Locale>
+			<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="'$(Cfg_1)'!=''">
+			<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
+			<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)'!=''">
+			<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>false</DCC_DebugInformation>
+		</PropertyGroup>
+		<ItemGroup>
+			<DelphiCompile Include="$(MainSource)">
+				<MainSource>MainSource</MainSource>
+			</DelphiCompile>
+			<DCCReference Include="TestuCalculator.pas"/>
+			<DCCReference Include="..\uCalculator.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>
+					<VersionInfo>
+						<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
+						<VersionInfo Name="AutoIncBuild">False</VersionInfo>
+						<VersionInfo Name="MajorVer">1</VersionInfo>
+						<VersionInfo Name="MinorVer">0</VersionInfo>
+						<VersionInfo Name="Release">0</VersionInfo>
+						<VersionInfo Name="Build">0</VersionInfo>
+						<VersionInfo Name="Debug">False</VersionInfo>
+						<VersionInfo Name="PreRelease">False</VersionInfo>
+						<VersionInfo Name="Special">False</VersionInfo>
+						<VersionInfo Name="Private">False</VersionInfo>
+						<VersionInfo Name="DLL">False</VersionInfo>
+						<VersionInfo Name="Locale">1033</VersionInfo>
+						<VersionInfo Name="CodePage">1252</VersionInfo>
+					</VersionInfo>
+					<VersionInfoKeys>
+						<VersionInfoKeys Name="CompanyName"/>
+						<VersionInfoKeys Name="FileDescription"/>
+						<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
+						<VersionInfoKeys Name="InternalName"/>
+						<VersionInfoKeys Name="LegalCopyright"/>
+						<VersionInfoKeys Name="LegalTrademarks"/>
+						<VersionInfoKeys Name="OriginalFilename"/>
+						<VersionInfoKeys Name="ProductName"/>
+						<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
+						<VersionInfoKeys Name="Comments"/>
+					</VersionInfoKeys>
+					<Source>
+						<Source Name="MainSource">CalculatorProjectTests.dpr</Source>
+					</Source>
+				</Delphi.Personality>
+				<Deployment/>
+				<Platforms>
+					<Platform value="Win64">False</Platform>
+					<Platform value="OSX32">False</Platform>
+					<Platform value="Win32">True</Platform>
+				</Platforms>
+				<UnitTesting>
+					<TestFramework>DUnit / Delphi Win32</TestFramework>
+					<TestRunner>GUI</TestRunner>
+					<SourceProjectName>C:\Code\NickDemoCode\Denmark\8 - Unit Testing\Code\CalculatorFromScrath\CalculatorProject.dproj</SourceProjectName>
+				</UnitTesting>
+			</BorlandProject>
+			<ProjectFileVersion>12</ProjectFileVersion>
+		</ProjectExtensions>
+		<Import Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')" Project="$(BDS)\Bin\CodeGear.Delphi.Targets"/>
+		<Import Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')" Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj"/>
+	</Project>

Denmark/8 - Unit Testing/Code/CalculatorFromScrath/Test/CalculatorProjectTests.res

Binary file added.

Denmark/8 - Unit Testing/Code/CalculatorFromScrath/Test/TestuCalculator.pas

+unit TestuCalculator;
+{
+
+  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, DateUtils, uCalculator;
+
+type
+  // Test methods for class TCalculator
+
+  TestTCalculator = class(TTestCase)
+  strict private
+    FCalculator: TCalculator;
+  public
+    procedure SetUp; override;
+    procedure TearDown; override;
+  published
+    procedure TestClear;
+    procedure TestEnter;
+    procedure TestPressPlus;
+    procedure TestPressEquals;
+    procedure TestCalculate;
+  end;
+
+implementation
+
+procedure TestTCalculator.SetUp;
+begin
+  FCalculator := TCalculator.Create;
+end;
+
+procedure TestTCalculator.TearDown;
+begin
+  FCalculator.Free;
+  FCalculator := nil;
+end;
+
+procedure TestTCalculator.TestClear;
+begin
+  // Arrange
+  // Act
+  FCalculator.Clear;
+
+  // Assert
+  // TODO: Validate method results
+end;
+
+procedure TestTCalculator.TestEnter;
+var
+  aValue: Integer;
+begin
+  // TODO: Setup method call parameters
+  FCalculator.Enter(aValue);
+  // TODO: Validate method results
+end;
+
+procedure TestTCalculator.TestPressPlus;
+begin
+  FCalculator.PressPlus;
+  // TODO: Validate method results
+end;
+
+procedure TestTCalculator.TestPressEquals;
+begin
+  FCalculator.PressEquals;
+  // TODO: Validate method results
+end;
+
+procedure TestTCalculator.TestCalculate;
+begin
+  FCalculator.Calculate;
+  // TODO: Validate method results
+end;
+
+initialization
+  // Register any test cases with the test runner
+  RegisterTest(TestTCalculator.Suite);
+end.
+

Denmark/8 - Unit Testing/Code/CalculatorFromScrath/Test/Win32/Debug/dunit.ini

+[GUITestRunner Config]
+AutoSave=1
+Left=50
+Top=50
+Width=508
+Height=504
+Maximized=0
+UseRegistry=0
+ResultsPanel.Height=174
+ErrorMessage.Height=75
+ErrorMessage.Visible=1
+FailureList.ColumnWidth[0]=120
+FailureList.ColumnWidth[1]=100
+FailureList.ColumnWidth[2]=200
+FailureList.ColumnWidth[3]=60
+HideTestNodesOnOpen=0
+BreakOnFailures=0
+FailOnNoChecksExecuted=0
+FailOnMemoryLeaked=0
+IgnoreSetUpTearDownLeaks=0
+ReportMemoryLeakTypes=0
+SelectTestedNode=1
+WarnOnFailTestOverride=0
+PopupX=350
+PopupY=30

Denmark/8 - Unit Testing/Code/CalculatorFromScrath/uCalculator.pas

+unit uCalculator;
+
+interface
+
+uses
+  DateUtils;
+
+type
+  TCalculatorOperation = (coNone, coSubtraction, coAddition);
+
+type
+  TCalculator = class
+  private
+    FIsDirty: Boolean;
+    FOperation: TCalculatorOperation;
+    FState: integer;
+    FDisplay: integer;
+    procedure SetDisplay(const Value: integer);
+  public
+    procedure Clear;
+    procedure Enter(aValue: integer);
+    procedure PressPlus;
+ //   procedure PressSubtract;
+    procedure PressEquals;
+    procedure Calculate;
+    property Display: integer read FDisplay write SetDisplay;
+  end;
+
+implementation
+
+{ TCalculator }
+
+procedure TCalculator.Calculate;
+begin
+  case FOperation of
+    coAddition:  Display :=    Display + FState;
+    coSubtraction : Display := Display - FState;
+  end;
+  FIsDirty := False;
+end;
+
+procedure TCalculator.Clear;
+begin
+  Display := 0;
+  FIsDirty := False;
+  FOperation := coNone;
+end;
+
+procedure TCalculator.Enter(aValue: integer);
+begin
+  FState := aValue;
+  FIsDirty := True;
+end;
+
+procedure TCalculator.PressEquals;
+begin
+  if FIsDirty then
+    Calculate;
+end;
+
+procedure TCalculator.PressPlus;
+begin
+  FOperation := coAddition;
+  if FIsDirty then
+    Calculate;
+end;
+
+//procedure TCalculator.PressSubtract;
+//begin
+//  FDisplay := FState;
+//  FOperation := coSubtraction;
+//  if FIsDirty then
+//    Calculate;
+//end;
+
+//procedure TCalculator.PressSubtract;
+//begin
+//  FDisplay := FState;
+//  FOperation := coSubtraction;
+//end;
+
+procedure TCalculator.SetDisplay(const Value: integer);
+begin
+  FDisplay := Value;
+end;
+
+end.

Denmark/8 - Unit Testing/Code/DateStuff/Debug/Win32/dunit.ini

 [GUITestRunner Config]
 AutoSave=1
-Left=-97
-Top=57
+Left=90
+Top=29
 Width=1121
 Height=669
 Maximized=0

Denmark/8 - Unit Testing/Code/DateStuff/UnitTests.DateUtils.pas

   Expected           : Word;
   i: integer;
 begin
-  for i := 1 to 10000 do
+  for i := 1 to 1000 do
   begin
     Expected    := 31;
     TestYear    := Random(5000) + 1;
   TestDate := EncodeDateTime(9, 8, 7, 6, 5, 4, 3);
   CheckTrue(SameDateTime(TestDate, IncWeek(TestDate, 0)), 'Incrementing the week by zero changed the date/time.');
 
-  for i := 1 to 10000 do
+  for i := 1 to 1000 do
   begin
     TempYear := Random(500) + 1900;  // Random year after the epoch
     TestDate := GetFirstDayOfFirstWeek(TempYear);
   CheckFalse(SameDateTime(TestDate, TestResult), 'IncMilliseocnd failed to change the given datetime/  ');
 
   // Check a whole lot of dates
-  for i        := 1 to 10000 do
+  for i        := 1 to 1000 do
   begin
     // What if you inc by zero?
     TestDate   := CreateRandomDate(False, 100, 2500);
   CheckTrue(SameDate(Expected, TestResult), 'IncMillisecond failed to add 5000 years worth of milliseconds.');
 
 
-  for i := 1 to 10000 do
+  for i := 1 to 1000 do
   begin
     YearsToAdd := Random(6000) + 1;
     TestDate := CreateRandomDate(False, 100, 2500);

Denmark/8 - Unit Testing/Code/Exceptions/Debug/Win32/dunit.ini

 PopupX=350
 PopupY=30
 
+[Tests.TestingExceptionsDemo.exe.TestTMyClass]
+

Denmark/8 - Unit Testing/Code/Exceptions/TestUnit1.pas

   TestFramework, SysUtils, Unit1;
 
 type
-  TTestCode = reference to procedure;
+  TTestCode = reference to procedure;  //TProc
   TClassOfException = class of Exception;
 
 type
 
 procedure TestTMyClass.TestThatExceptionHappensUsingCheckException;
 begin
-   CheckException(ExceptionRaisingMethod, ETestingException);
+   CheckException(FMyClass.RaiseTestingException, ETestingException);
 end;
 
 procedure TestTMyClass.TestThatExceptionHappensUsingWrapper;
 begin
+  //Arrange
   StartExpectingException(ETestingException);
+  //Act
   FMyClass.RaiseTestingException;
+  //Assert
   StopExpectingException('Stopped waiting for ETestingException to be raised');
 
 end;

Denmark/8 - Unit Testing/Unit Testing with Delphi.pptx

Binary file added.

Denmark/9 - Mocking/Code/MockDemo/TestWidgetProcessor.pas

   ExpectedResult: Boolean;
   MockVerifier: TMock<IWidgetVerifier>;
   GoodTestWidget: TWidget;
+  BadTestWidget: TWidget;
 begin
   StubLogger := TMock<ILogger>.Create;
   StubLogger.Setup.WillReturnDefault('Log', 0);
 
   GoodTestWidget := TWidget.Create('GoodWidget');
   try
+  //Arrange
   MockVerifier := TMock<IWidgetVerifier>.Create;
-  MockVerifier.Setup.WillReturn(False).When.VerifyWidget(GoodTestWidget);
+  MockVerifier.Setup.WillReturn(True).When.VerifyWidget(GoodTestWidget);
+//  MockVerifier.Setup.WillReturn(False).When.VerifyWidget(GoodTestWidget);
+//  MockVerifier.Setup.Expect.Never.When.VerifyWidget(GoodTestWidget);
+
+  //Act
   SUT := TWidgetProcessor.Create(StubLogger, MockVerifier);
-  SUT.ProcessWidgets(GoodTestWidget);
+  ExpectedResult := SUT.ProcessWidgets(GoodTestWidget);
+
+  //Assert;
+  CheckTrue(ExpectedResult);
   StubLogger.Verify;
+  MockVerifier.Verify;
+
   finally
     GoodTestWidget.Free
   end;
-
-
 end;
 
 procedure TestTWidgetProcessor.CheckException(aExceptionType: TClassOfException; aCode: TTestCode; const aMessage: String);

Denmark/9 - Mocking/Code/MockDemo/uBasicLogger.pas

 
 interface
 
+uses
+      uLoggerIntf
+    , SysUtils
+    ;
+
 type
 
-TBasicLogger =
+  TBasicLogger = class(TInterfacedObject, ILogger)
+    procedure Log(const aDateTime: TDateTime; aMessage: string);
+  end;
 
 implementation
 
+{ TBasicLogger }
+
+procedure TBasicLogger.Log(const aDateTime: TDateTime; aMessage: string);
+begin
+  WriteLn(FormatDateTime(FormatSettings.ShortDateFormat, aDateTime), ': ', aMessage);
+end;
+
 end.

Denmark/9 - Mocking/Code/MockDemo/uWidgetProcessor.pas

   public
     constructor Create(aLogger: ILogger; aVerifier: IWidgetVerifier);
     function ProcessWidgets(aWidget: TWidget): Boolean;
-    function VerifyWidget(aWidget: TWidget): Boolean;
   end;
 
 implementation

Denmark/9 - Mocking/Code/StubDemo/Debug/Win32/dunit.ini

 PopupX=350
 PopupY=30
 
+[Tests.TestStubDemo.exe.TestTWidgetProcessor]
+

Denmark/9 - Mocking/Mocking.pptx

Binary file added.