I've written a CodeAnalyzer/CodeFix using VS Community 17.4.3, and I'm trying to test them with the Visual Studio generated unit test code. The analyzer text runs successfully, and the CodeFix produces what appears to be a valid modified document. However, the CodeFix test fails because CodeFixTest<TVerifier>.FixEachAnalyzerDiagnosticAsync() returns an error. Specifically, the failure is caused by
var fixedProject = await ApplyCodeActionAsync(project, actionToApply, verifier, cancellationToken).ConfigureAwait(false);
if (fixedProject != project)
{
done = false;
project = fixedProject;
break;
}
because the fixedProject and project are not equal.
I'm a bit lost trying to resolve this because no real projects are involved. The test is using hardcoded strings as both input and expected output.
I've validated the output from the CodeFix equals the expected modification fed to the unit test. I was expecting the unit test to succeed.