Delphi Mock Wizard
Let me preface this by saying I'm fairly new to Unit Testing, Mocks, Stubs, Etc...
I've installed Delphi-Mock-Wizard. When I select a unit and "Generate Mock", a new unit is created but it's very basic and not anything what I understand Mocks to be.
unit Unit1;
(** WARNING - AUTO-GENERATED MOCK! Change this unit if you want to, but be aware that any changes you make will be lost if you regenerate the mock object (for instance, if the interface changes).
My advice is to create a descendent class of your auto-generated mock - in a different unit - and override things there. That way you get to keep them.
Also, the auto-generate code is not yet smart enough to generate stubs for inherited interfaces. In that case, change your mock declaration to inherit from a mock implementation that implements the missing interface. This,
unfortunately, is a violation of the directive above. I'm working on it. You may also need to manually change the unit name, above. Another thing I am working on. **)
interface
uses
PascalMock,
Te开发者_StackOverflow社区stInterfaces;
type
IThingy = interface;
implementation
end.
Looking at the source there seems to be quite a bit commented out. I'm wondering, has anyone gotten this to work?
My IDE is D2010.
Thanks.
The Delphi Mock Wizard is not finished. It's barely even functional. The output you posted in your question looks like the only thing that tool is capable of generating. If you want to use it, you'll have to wait until it matures. Since it was last updated in October 2008, you might have to wait a long, long time.
You'll have to choose a different direction for your mocking needs. Please see an earlier Stack Overflow question for advice:
What is your favorite Delphi mocking library?
精彩评论