Skip to content

Commit eca7306

Browse files
authored
Update to verify 4 (#143)
1 parent 8b113f3 commit eca7306

9 files changed

Lines changed: 22 additions & 20 deletions

File tree

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project>
33
<PropertyGroup>
44
<NoWarn>CS1591;CS0649;CS8632</NoWarn>
5-
<Version>1.1.0</Version>
5+
<Version>1.2.0</Version>
66
<AssemblyVersion>1.0.0</AssemblyVersion>
77
<PackageTags>EntityFramework, Verify</PackageTags>
88
<Description>Extends Verify (https://github.com/VerifyTests/Verify) to allow verification of EntityFramework bits.</Description>

src/Verify.EntityFramework/Converters/QueryableConverter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ public override bool CanConvert(Type type)
3636
return IsQueryable(type);
3737
}
3838

39-
public static bool IsQueryable(Type type)
39+
public static bool IsQueryable(object target)
4040
{
41+
var type = target.GetType();
4142
if (!type.IsGenericType)
4243
{
4344
return false;

src/Verify.EntityFramework/Verify.EntityFramework.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
</PropertyGroup>
55
<ItemGroup>
66
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.4" />
7-
<PackageReference Include="Verify" Version="3.1.0" />
7+
<PackageReference Include="Verify" Version="4.0.0" />
88
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
99
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.4" />
1010
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />

src/Verify.EntityFramework/VerifyEntityFramework.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ public static class VerifyEntityFramework
77
{
88
public static void Enable()
99
{
10-
SharedVerifySettings.RegisterFileConverter("txt", QueryableToSql, QueryableConverter.IsQueryable);
10+
SharedVerifySettings.RegisterFileConverter(
11+
"txt",
12+
QueryableToSql,
13+
QueryableConverter.IsQueryable);
1114
SharedVerifySettings.ModifySerialization(settings =>
1215
{
1316
settings.AddExtraSettings(serializer =>

src/Verify.EntityFrameworkClassic.Tests/CoreTests.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,15 @@ public async Task Queryable()
121121
}
122122
#endregion
123123

124-
public CoreTests(ITestOutputHelper output) :
125-
base(output)
124+
static CoreTests()
126125
{
126+
sqlInstance = new SqlInstance<SampleDbContext>(
127+
constructInstance: connection => new SampleDbContext(connection),
128+
storage: Storage.FromSuffix<SampleDbContext>("Tests"));
127129
}
128130

129-
static CoreTests()
131+
public CoreTests(ITestOutputHelper output) :
132+
base(output)
130133
{
131-
sqlInstance = new SqlInstance<SampleDbContext>(
132-
constructInstance: connection => new SampleDbContext(connection),instanceSuffix:"Tests");
133134
}
134135
}

src/Verify.EntityFrameworkClassic.Tests/Snippets/DbContextBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ static DbContextBuilder()
1010
sqlInstance = new SqlInstance<SampleDbContext>(
1111
buildTemplate: CreateDb,
1212
constructInstance: connection => new SampleDbContext(connection),
13-
instanceSuffix: "Classic");
13+
storage: Storage.FromSuffix<SampleDbContext>("Classic"));
1414
}
1515

1616
static SqlInstance<SampleDbContext> sqlInstance;

src/Verify.EntityFrameworkClassic/Converters/QueryableConverter.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,8 @@ public override bool CanConvert(Type type)
3535
return IsQueryable(type);
3636
}
3737

38-
public static bool IsQueryable(Type type)
38+
public static bool IsQueryable(object target)
3939
{
40-
if (!type.IsGenericType)
41-
{
42-
return false;
43-
}
44-
45-
var genericType = type.GetGenericTypeDefinition();
46-
return genericType == typeof(IQueryable<>);
40+
return target is IQueryable;
4741
}
4842
}

src/Verify.EntityFrameworkClassic/Verify.EntityFrameworkClassic.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
</PropertyGroup>
55
<ItemGroup>
66
<PackageReference Include="EntityFramework" Version="6.4.4" />
7-
<PackageReference Include="Verify" Version="3.1.0" />
7+
<PackageReference Include="Verify" Version="4.0.0" />
88
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
99
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
1010
<PackageReference Include="ProjectDefaults" Version="1.0.42" PrivateAssets="All" />

src/Verify.EntityFrameworkClassic/VerifyEntityFrameworkClassic.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ public static class VerifyEntityFrameworkClassic
77
{
88
public static void Enable()
99
{
10-
SharedVerifySettings.RegisterFileConverter("txt", QueryableToSql, QueryableConverter.IsQueryable);
10+
SharedVerifySettings.RegisterFileConverter(
11+
"txt",
12+
QueryableToSql,
13+
QueryableConverter.IsQueryable);
1114
SharedVerifySettings.ModifySerialization(settings =>
1215
{
1316
settings.AddExtraSettings(serializer =>

0 commit comments

Comments
 (0)