Error while creating tests in Visual Studio
- by Benjol
When I try to generate a unit test for the following method (in a public static class)
private static string[] GetFields(string line, char sep)
{
char[] totrim = { '"', ' ' };
return line.Split(sep).Select(col => col.Trim(totrim)).ToArray();
}
The Tests output says:
While trying to generate your tests, the following errors occurred:
This method or property cannot be called within an event handler.
It works if I make the function public - I've tried running Publicize.exe manually, it doesn't complain, but doesn't make any difference either.