Currently, the code generator returns a block that looks something like this:
var diagnoser = new Mock<IDiagnoser>();
Expression<Func<IDiagnoser, Task<IEnumerable<Diagnostic>>>> getDiagnosticsAsync = x => x.GetDiagnosticsAsync(It.IsAny<TextDocumentItem>());
diagnoser
.Setup(getDiagnosticsAsync)
.Returns((TextDocumentItem item) =>
{
return;
}
);
diagnoser.Verify(getDiagnosticsAsync, Times.Once);
That leads to lots of red squiggly lines, and, 3 errors (may be different depending on the generated text.) Currently those errors are:
Feature 'inferred delegate type' is not available in C# 9.0. Please use language version 10.0 or greater. [UnitTests.Features]
The delegate type could not be inferred. [UnitTests.Features]
An object of a type convertible to 'Task<IEnumerable>' is required [UnitTests.Features]
It looks like we'll simply be able to change the generator to add the word "default", as in the example below. That should also save us from having to actually do symbol parsing on nested generic or nullable types.
var diagnoser = new Mock<IDiagnoser>();
Expression<Func<IDiagnoser, Task<IEnumerable<Diagnostic>>>> getDiagnosticsAsync = x => x.GetDiagnosticsAsync(It.IsAny<TextDocumentItem>());
diagnoser
.Setup(getDiagnosticsAsync)
.Returns((TextDocumentItem item) =>
{
return default;
}
);
diagnoser.Verify(getDiagnosticsAsync, Times.Once);
Currently, the code generator returns a block that looks something like this:
That leads to lots of red squiggly lines, and, 3 errors (may be different depending on the generated text.) Currently those errors are:
It looks like we'll simply be able to change the generator to add the word "default", as in the example below. That should also save us from having to actually do symbol parsing on nested generic or nullable types.