Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<PropertyGroup>
<NoWarn>CS1591;CS0649;CS8632</NoWarn>
<Version>1.1.0</Version>
<Version>1.2.0</Version>
<AssemblyVersion>1.0.0</AssemblyVersion>
<PackageTags>EntityFramework, Verify</PackageTags>
<Description>Extends Verify (https://github.com/VerifyTests/Verify) to allow verification of EntityFramework bits.</Description>
Expand Down
3 changes: 2 additions & 1 deletion src/Verify.EntityFramework/Converters/QueryableConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ public override bool CanConvert(Type type)
return IsQueryable(type);
}

public static bool IsQueryable(Type type)
public static bool IsQueryable(object target)
{
var type = target.GetType();
if (!type.IsGenericType)
{
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/Verify.EntityFramework/Verify.EntityFramework.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.4" />
<PackageReference Include="Verify" Version="3.1.0" />
<PackageReference Include="Verify" Version="4.0.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.4" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
Expand Down
5 changes: 4 additions & 1 deletion src/Verify.EntityFramework/VerifyEntityFramework.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ public static class VerifyEntityFramework
{
public static void Enable()
{
SharedVerifySettings.RegisterFileConverter("txt", QueryableToSql, QueryableConverter.IsQueryable);
SharedVerifySettings.RegisterFileConverter(
"txt",
QueryableToSql,
QueryableConverter.IsQueryable);
SharedVerifySettings.ModifySerialization(settings =>
{
settings.AddExtraSettings(serializer =>
Expand Down
11 changes: 6 additions & 5 deletions src/Verify.EntityFrameworkClassic.Tests/CoreTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,15 @@ public async Task Queryable()
}
#endregion

public CoreTests(ITestOutputHelper output) :
base(output)
static CoreTests()
{
sqlInstance = new SqlInstance<SampleDbContext>(
constructInstance: connection => new SampleDbContext(connection),
storage: Storage.FromSuffix<SampleDbContext>("Tests"));
}

static CoreTests()
public CoreTests(ITestOutputHelper output) :
base(output)
{
sqlInstance = new SqlInstance<SampleDbContext>(
constructInstance: connection => new SampleDbContext(connection),instanceSuffix:"Tests");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ static DbContextBuilder()
sqlInstance = new SqlInstance<SampleDbContext>(
buildTemplate: CreateDb,
constructInstance: connection => new SampleDbContext(connection),
instanceSuffix: "Classic");
storage: Storage.FromSuffix<SampleDbContext>("Classic"));
}

static SqlInstance<SampleDbContext> sqlInstance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,8 @@ public override bool CanConvert(Type type)
return IsQueryable(type);
}

public static bool IsQueryable(Type type)
public static bool IsQueryable(object target)
{
if (!type.IsGenericType)
{
return false;
}

var genericType = type.GetGenericTypeDefinition();
return genericType == typeof(IQueryable<>);
return target is IQueryable;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="EntityFramework" Version="6.4.4" />
<PackageReference Include="Verify" Version="3.1.0" />
<PackageReference Include="Verify" Version="4.0.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="ProjectDefaults" Version="1.0.42" PrivateAssets="All" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ public static class VerifyEntityFrameworkClassic
{
public static void Enable()
{
SharedVerifySettings.RegisterFileConverter("txt", QueryableToSql, QueryableConverter.IsQueryable);
SharedVerifySettings.RegisterFileConverter(
"txt",
QueryableToSql,
QueryableConverter.IsQueryable);
SharedVerifySettings.ModifySerialization(settings =>
{
settings.AddExtraSettings(serializer =>
Expand Down