This page cannot be shown here. You can still read it on the original site — the toolbar below keeps your place in the directory.
Writing good unit tests is made much easier by dependency injection . This lets you separate your code’s behavior from that of your dependencies: type MyType struct { dep1 DependencyOne dep2 DependencyTwo } func GoodConstructor ( dep1 DependencyOne , dep2 DependencyTwo ) * MyType { return & MyType { dep1 : dep1 , dep2 : dep2 , } } func BadConstructor () * MyType { return & MyType { dep1 :…
Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.