The Markdown class should implement an interace to make mocking easier
GoogleCodeExporter opened this issue · comments
What steps will reproduce the problem?
Public methods are not virtual so some mocking frameworks are unable to easily
mock the Markdown class for unit testing.
What is the expected output? What do you see instead?
N/A
What version of the product are you using? On what operating system?
1.12, Windows
Please provide any additional information below.
Using Visual Studio refactoring tools, simply use Create Interface. This will
create an IMarkdown (by default) interface and set the class to implement it.
Users can then mock this interface for unit tests, supplying an instance of the
class for production code.
Original issue reported on code.google.com by tvanfos...@gmail.com
on 10 Jun 2010 at 6:19
I don't understand the advantage here versus the existing unit tests that are
shipped in the code?
Original comment by wump...@gmail.com
on 3 Jul 2010 at 8:15
The point is that I would like to mock out the Markdown class in my code. Most
mocking frameworks require that you mock an interface or that the class have
virtual methods. Adding an interface, which the Markdown class implements,
makes it trivial to mock it in my code.
Original comment by tvanfos...@gmail.com
on 6 Jul 2010 at 1:31
Original comment by wump...@gmail.com
on 12 Nov 2010 at 9:03
- Added labels: Priority-Low
- Removed labels: Priority-Medium
Original comment by wump...@gmail.com
on 12 Nov 2010 at 9:04
- Added labels: Type-Enhancement
- Removed labels: Type-Defect