-
Couldn't load subscription status.
- Fork 113
Quick Start Guide
vincentparrett edited this page Sep 18, 2011
·
11 revisions
##Delphi-Mocks
Delphi-Mocks is simple mocking framework for Delphi. It's intended to be used in conjunction with unit testing. The api is fluent where possible, and strongly typed where possible.
###RTTI on interfaces
Delph-Mocks currently only supports mocking interfaces, and is only supported in Delphi XE2. An interface must have Runtime Type Information (RTTI), to enable RTTI on an interface, add the {$M+} compiler directive before it.
{$M+}
IFoo = interface
procedure Bar;
end;
We make extensive use of Generics in the framework. To create the mock, we use the TInterfaceMock.Create class function,
procedure Test;
var
mock : TInterfaceMock<IFoo>; //our mock object
begin
//Create our mock
mock := TInterfaceMock<IFoo>.Create;
...
end;