-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
MaterializationInterceptionSqliteTest.cs
57 lines (45 loc) · 2.19 KB
/
MaterializationInterceptionSqliteTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#nullable enable
using Microsoft.EntityFrameworkCore.Sqlite.Internal;
namespace Microsoft.EntityFrameworkCore;
public class MaterializationInterceptionSqliteTest :
MaterializationInterceptionTestBase<MaterializationInterceptionSqliteTest.SqliteLibraryContext>,
IClassFixture<MaterializationInterceptionSqliteTest.MaterializationInterceptionSqliteFixture>
{
public MaterializationInterceptionSqliteTest(MaterializationInterceptionSqliteFixture fixture)
: base(fixture)
{
}
public override async Task Intercept_query_materialization_with_owned_types_projecting_collection(bool async)
=> Assert.Equal(
SqliteStrings.ApplyNotSupported,
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Intercept_query_materialization_with_owned_types_projecting_collection(async)))
.Message);
public class SqliteLibraryContext : LibraryContext
{
public SqliteLibraryContext(DbContextOptions options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<TestEntity30244>().OwnsMany(e => e.Settings, b => b.ToJson());
}
}
public override LibraryContext CreateContext(IEnumerable<ISingletonInterceptor> interceptors, bool inject)
=> new SqliteLibraryContext(Fixture.CreateOptions(interceptors, inject));
public class MaterializationInterceptionSqliteFixture : SingletonInterceptorsFixtureBase
{
protected override string StoreName
=> "MaterializationInterception";
protected override ITestStoreFactory TestStoreFactory
=> SqliteTestStoreFactory.Instance;
protected override IServiceCollection InjectInterceptors(
IServiceCollection serviceCollection,
IEnumerable<ISingletonInterceptor> injectedInterceptors)
=> base.InjectInterceptors(serviceCollection.AddEntityFrameworkSqlite(), injectedInterceptors);
}
}