Open tpodolak opened 6 years ago
I never use VisualBasic for anything so there is no need for me. But we can of course add support if you feel like contributing. The current API is perhaps not ideal for adding support for VB.
One way could perhaps be to use heuristics and figure out if the code passed in as text is VB or C# and fall back to trying both if we can't figure out language.
Another alternative is an implementation split where we create a class VbAssert
it will mean some duplication but we can just throw tests at it.
The current DiagnosticAsssert
is poorly named, better would have been CsharpAssert
or RoslynAssert
but that is unrelated to the issue.
I know that @sharwell is working on an official Roslyn test fixture that is probably worth checking out. I don't remember the nuget/myget link for it.
Here's an example of adding a reference to Microsoft.CodeAnalysis.Testing: dotnet/roslyn-analyzers@b164e8d2cc44a469917e2c6c5fa45e464bdd980f
It supports VB, but the markup syntax is different from the one used in Gu.Roslyn.Asserts. However, it seems like it would be possible to update Gu.Roslyn.Asserts to simply extend Microsoft.CodeAnalysis.Testing by creating a class similar to CSharpCodeFixVerifier<TAnalyzer, TCodeFix>
from the example commit that exposes the functionality using an API similar to this library.
Another not so pretty alternative is adding a static property Language
to DiagnosticAssert
It looks like Gu.Roslyn.Asserts support only C# language, any plans for supporting VisualBasic as well? I can help with implementation if you can tell me how would you see it incorporated in current API