mirror of
https://github.com/zoriya/EntityFrameworkCore.Projectables.git
synced 2026-08-15 18:44:57 +00:00
Generate diagnostic when null conditional expressions are used but rewrite is not configured
This commit is contained in:
+21
@@ -487,6 +487,27 @@ namespace Foo {
|
||||
return Verifier.Verify(result.GeneratedTrees[0].ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NullableMemberBinding_WithoutSupport_IsBeingReported()
|
||||
{
|
||||
var compilation = CreateCompilation(@"
|
||||
using System;
|
||||
using System.Linq;
|
||||
using EntityFrameworkCore.Projectables;
|
||||
|
||||
namespace Foo {
|
||||
static class C {
|
||||
[Projectable(NullConditionalRewriteSupport = NullConditionalRewriteSupport.None)]
|
||||
public static int? GetLength(this string input) => input?.Length;
|
||||
}
|
||||
}
|
||||
");
|
||||
var result = RunGenerator(compilation);
|
||||
|
||||
var diagnostic = Assert.Single(result.Diagnostics);
|
||||
Assert.Equal("EFP0002", diagnostic.Id);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public Task NullableMemberBinding_WithIgnoreSupport_IsBeingRewritten()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user