mirror of
https://github.com/zoriya/EntityFrameworkCore.Projectables.git
synced 2026-06-02 06:25:17 +00:00
Ensure that NamedTypeSymbols are not being rewritten
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
using EntityFrameworkCore.Projectables;
|
||||
|
||||
namespace EntityFrameworkCore.Projectables.Generated
|
||||
#nullable disable
|
||||
{
|
||||
public static class _SomeExtensions_Test
|
||||
{
|
||||
public static System.Linq.Expressions.Expression<System.Func<global::SomeFlag, bool>> Expression()
|
||||
{
|
||||
return (global::SomeFlag f) =>
|
||||
f == global::SomeFlag.Foo;
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
using EntityFrameworkCore.Projectables;
|
||||
|
||||
namespace EntityFrameworkCore.Projectables.Generated
|
||||
#nullable disable
|
||||
{
|
||||
public static class _SomeExtensions_Test
|
||||
{
|
||||
public static System.Linq.Expressions.Expression<System.Func<global::SomeFlag, bool>> Expression()
|
||||
{
|
||||
return (global::SomeFlag f) =>
|
||||
f == global::SomeFlag.Foo;
|
||||
}
|
||||
}
|
||||
}
|
||||
+26
@@ -1019,6 +1019,32 @@ namespace Foos {
|
||||
return Verifier.Verify(result.GeneratedTrees[0].ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public Task EnumAccessor()
|
||||
{
|
||||
var compilation = CreateCompilation(@"
|
||||
using EntityFrameworkCore.Projectables;
|
||||
|
||||
public enum SomeFlag
|
||||
{
|
||||
Foo
|
||||
}
|
||||
|
||||
public static class SomeExtensions
|
||||
{
|
||||
[Projectable]
|
||||
public static bool Test(this SomeFlag f) => f == SomeFlag.Foo;
|
||||
}
|
||||
");
|
||||
|
||||
var result = RunGenerator(compilation);
|
||||
|
||||
Assert.Empty(result.Diagnostics);
|
||||
Assert.Single(result.GeneratedTrees);
|
||||
|
||||
return Verifier.Verify(result.GeneratedTrees[0].ToString());
|
||||
}
|
||||
|
||||
#region Helpers
|
||||
|
||||
Compilation CreateCompilation(string source, bool expectedToCompile = true)
|
||||
|
||||
Reference in New Issue
Block a user