mirror of
https://github.com/zoriya/EntityFrameworkCore.Projectables.git
synced 2026-08-15 18:44:57 +00:00
Keep leading and traling trivias on identifiers to prevent some syntax errors
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using EntityFrameworkCore.Projectables;
|
||||
using Foo;
|
||||
|
||||
// <auto-generated/>
|
||||
namespace EntityFrameworkCore.Projectables.Generated
|
||||
#nullable disable
|
||||
{
|
||||
public static class Foo_A_IsB
|
||||
{
|
||||
public static System.Linq.Expressions.Expression<System.Func<global::Foo.A, bool>> Expression()
|
||||
{
|
||||
return (global::Foo.A @this) =>
|
||||
@this is global::Foo.B;
|
||||
}
|
||||
}
|
||||
}
|
||||
+26
@@ -343,6 +343,32 @@ namespace Foo {
|
||||
return Verifier.Verify(result.GeneratedTrees[0].ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public Task InOperator()
|
||||
{
|
||||
var compilation = CreateCompilation(@"
|
||||
using System;
|
||||
using System.Linq;
|
||||
using EntityFrameworkCore.Projectables;
|
||||
namespace Foo {
|
||||
class A {
|
||||
[Projectable]
|
||||
public bool IsB => this is B;
|
||||
}
|
||||
|
||||
class B : A {
|
||||
}
|
||||
}
|
||||
");
|
||||
|
||||
var result = RunGenerator(compilation);
|
||||
|
||||
Assert.Empty(result.Diagnostics);
|
||||
Assert.Single(result.GeneratedTrees);
|
||||
|
||||
return Verifier.Verify(result.GeneratedTrees[0].ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public Task ProjectableExtensionMethod()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user