-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
StoreGeneratedFixupSqliteTest.cs
46 lines (34 loc) · 1.5 KB
/
StoreGeneratedFixupSqliteTest.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
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// ReSharper disable InconsistentNaming
namespace Microsoft.EntityFrameworkCore;
public class StoreGeneratedFixupSqliteTest : StoreGeneratedFixupRelationalTestBase<
StoreGeneratedFixupSqliteTest.StoreGeneratedFixupSqliteFixture>
{
public StoreGeneratedFixupSqliteTest(StoreGeneratedFixupSqliteFixture fixture)
: base(fixture)
{
}
[ConditionalFact]
public void Temp_values_can_be_made_permanent()
{
using var context = CreateContext();
var entry = context.Add(new TestTemp());
Assert.True(entry.Property(e => e.Id).IsTemporary);
Assert.False(entry.Property(e => e.NotId).IsTemporary);
var tempValue = entry.Property(e => e.Id).CurrentValue;
entry.Property(e => e.Id).IsTemporary = false;
context.SaveChanges();
Assert.False(entry.Property(e => e.Id).IsTemporary);
Assert.Equal(tempValue, entry.Property(e => e.Id).CurrentValue);
}
protected override bool EnforcesFKs
=> true;
protected override void UseTransaction(DatabaseFacade facade, IDbContextTransaction transaction)
=> facade.UseTransaction(transaction.GetDbTransaction());
public class StoreGeneratedFixupSqliteFixture : StoreGeneratedFixupRelationalFixtureBase
{
protected override ITestStoreFactory TestStoreFactory
=> SqliteTestStoreFactory.Instance;
}
}