testfx
testfx copied to clipboard
Disallow test methods with out/ref parameters
Today, the following is allowed:
[TestMethod]
[DataRow("Hello", "World")]
public void TestMethod1(out string s, ref string s2)
{
s = "";
}
I think we should:
- Fail at run time when we encounter such a test method.
- Update the analyzer for test method validity to also produce a compile-time warning.
It's technically a breaking change, but I think it's acceptable and is unlikely that people are doing this today.
If we want to be really safe, we could start by introducing the analyzer and wait for a few versions.