mirror of
https://github.com/zoriya/EntityFrameworkCore.Projectables.git
synced 2026-08-15 18:44:57 +00:00
Raise diagnostics when not exposing expression bodies members
This commit is contained in:
+43
@@ -340,6 +340,49 @@ namespace Foo {
|
||||
return Verifier.Verify(result.GeneratedTrees[0].ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BlockBodiedMember_RaisesDiagnostics()
|
||||
{
|
||||
var compilation = CreateCompilation(@"
|
||||
using System;
|
||||
using EntityFrameworkCore.Projections;
|
||||
namespace Foo {
|
||||
class C {
|
||||
[Projectable]
|
||||
public int Foo
|
||||
{
|
||||
get => 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
");
|
||||
|
||||
var result = RunGenerator(compilation);
|
||||
|
||||
Assert.Single(result.Diagnostics);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BlockBodiedMethod_RaisesDiagnostics()
|
||||
{
|
||||
var compilation = CreateCompilation(@"
|
||||
using System;
|
||||
using EntityFrameworkCore.Projections;
|
||||
namespace Foo {
|
||||
class C {
|
||||
[Projectable]
|
||||
public int Foo()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
");
|
||||
|
||||
var result = RunGenerator(compilation);
|
||||
|
||||
Assert.Single(result.Diagnostics);
|
||||
}
|
||||
|
||||
#region Helpers
|
||||
|
||||
|
||||
Reference in New Issue
Block a user