When writing Go code the general guideline is not to create interfaces unless it is really needed. A good example would be an interface with only one concrete implementation. Now for the mind boggling part; in C# we would probably create that interface if the type needs to be faked in some test while in Go you wouldn't. Or actually you would. But in a different place...
Showing posts with label fake. Show all posts
Showing posts with label fake. Show all posts
2016-09-15
2015-06-18
Timetravel in C# done right
Testing things where you need to fake time is not hard given the right abstractions. That is why when I read this article I felt really sad. Because while the article describes one way to fake time it does so by breaking three fundamentals which is pretty hard in three lines of relevant code...
2014-12-04
Faking 3rd party dependencies
When it comes to dealing with third party dependencies in my code I've used the same trick for a long time. But I was recently introduced to a new trick that I have mixed feelings about.
2014-09-25
Testing with fakes or stubs? That is the question!
I like testing with stubs. But once in a while I encounter people that rather use fakes. And that is a pattern I try to avoid.
2014-09-18
Spies and Stubs
I was reading this article which is a response to an email from a person liking mocks but disliking spies. Before starting to read I was confused since I personally dislike mocks and spies sounded even worse. However it turned out I was wrong.
2013-10-03
Evolution of a handrolled fake - part 5
As you may know if you followed my blog before; I like to roll my own fake. For interfaces it is pretty straight forward with explicit implementation of the interface and properties with delegates for implementation.
Subscribe to:
Posts (Atom)