I am using x-unit. We use test output. We have things in a base class. We currently inject ITestOutputHelper like this:
public class AnyTestClass : TestBase
{
[Fact]
public void SomeTest()
{
}
public AnyTestClass( ITestOutputHelper output ) : base(output)
{
}
}
whereas I want the code to look like:
public class AnyTestClass : TestBase
{
[Fact]
public void SomeTest()
{
}
}
I very much hate having to put that delegating constructor in. It's always the same, it's work, it clutters up the code, it adds nothing for the reader, it's duplicated code... and it just feels very "wrong".
Is there any way of getting around it? I've been thinking x-unit has to exist in the stack, and one of those things in the stack has to have a reference to ITestOutputHelper, which I must be able to get out with reflection.... Anybody done it and can save me some time looking?
Basically - I'm prepared to do a ridiculous amount of extra work or extra compute to make our codebase a little cleaner - and this is a clear example of code that adds no value whatsoever to the reader.