mirror of
https://github.com/zoriya/EntityFrameworkCore.Projectables.git
synced 2026-05-23 19:25:45 +00:00
Added a repro
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using EntityFrameworkCore.Projectables;
|
||||
using Foo;
|
||||
|
||||
namespace EntityFrameworkCore.Projectables.Generated
|
||||
#nullable disable
|
||||
{
|
||||
public static class Foo_Bar_ProjectedId
|
||||
{
|
||||
public static System.Linq.Expressions.Expression<System.Func<global::Foo.Bar, int>> Expression()
|
||||
{
|
||||
return (global::Foo.Bar @this) =>
|
||||
Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using EntityFrameworkCore.Projectables;
|
||||
using Foo;
|
||||
|
||||
namespace EntityFrameworkCore.Projectables.Generated
|
||||
#nullable disable
|
||||
{
|
||||
public static class Foo_Bar_ProjectedId
|
||||
{
|
||||
public static System.Linq.Expressions.Expression<System.Func<global::Foo.Bar, int>> Expression()
|
||||
{
|
||||
return (global::Foo.Bar @this) =>
|
||||
@this.Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
+29
@@ -959,6 +959,35 @@ namespace Foo {
|
||||
return Verifier.Verify(result.GeneratedTrees[0].ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public Task InheritedMembers()
|
||||
{
|
||||
var compilation = CreateCompilation(@"
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using EntityFrameworkCore.Projectables;
|
||||
|
||||
namespace Foo {
|
||||
public class Foo {
|
||||
public int Id { get; set; }
|
||||
}
|
||||
|
||||
public class Bar : Foo {
|
||||
[Projectable]
|
||||
public int ProjectedId => Id;
|
||||
}
|
||||
}
|
||||
");
|
||||
|
||||
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