Closed jpreese closed 7 years ago
unless there is not limit I'll deal with it :)
There is no limit! Go for it! :)
Btw this generator could use some helper method like existing "RunTally" that convert IO Stream to string. I don't see such option now. So one solution will be to add this logic for every test or maybe better - extend generator Output API to have option to write custom methods, code in test class. What do you think?
I agree, and in principle this is already supported as the TestClass
class has a property Methods
(note that I explicitly named it Methods
, not TestMethods
, to which you could then add the utility method. At the moment, the CreateTestClass
function creates the TestClass
instance. We can do several things:
CreateTestClass
virtual so that you can add additional methods.Exercise
class, named something like RenderAdditionalMethods
, that returns a string[] and combine that with the output of RenderTestMethods
.My preference goes to option 2, what about you? And @robkeim and @jpreese ?
@ErikSchierboom option 2 would also be my preferred solution as I think it's more explicit.
If I understand the problem scope correctly, in the sense that we want the ability to add helper methods to the generated test suite, Option 2 seems like the best approach.
We can take the string array and just append it onto the end of the collection of tests so that the helpers always appear at the bottom.
Let's create separate issue for that.
@GKotfis Thanks to @GKotfis, there is now support for additional methods (see #454).
Closed by #457
This issue is part of an overall initiative to complete #195.
The documentation on how to add generators can be found here. If you get stuck or have any questions about adding this generator, please do not hesitate to reach out!