3
3
4
4
using System ;
5
5
using System . Threading . Tasks ;
6
- #if Test20
7
- using Microsoft . EntityFrameworkCore . Internal ;
8
- #else
9
6
using Microsoft . EntityFrameworkCore . InMemory . Internal ;
10
- #endif
11
7
using Microsoft . EntityFrameworkCore . TestModels . UpdatesModel ;
12
- using Xunit ;
13
8
14
9
namespace Microsoft . EntityFrameworkCore
15
10
{
@@ -21,106 +16,6 @@ protected UpdatesInMemoryTestBase(TFixture fixture)
21
16
{
22
17
}
23
18
24
- #if ! Test20
25
- [ Fact ]
26
- public virtual void Update_on_bytes_concurrency_token_original_value_matches_throws_with_quirk ( )
27
- {
28
- var productId = Guid . NewGuid ( ) ;
29
-
30
- try
31
- {
32
- AppContext . SetSwitch ( "Microsoft.EntityFrameworkCore.Issue12214" , true ) ;
33
-
34
- ExecuteWithStrategyInTransaction (
35
- context =>
36
- {
37
- context . Add (
38
- new ProductWithBytes
39
- {
40
- Id = productId ,
41
- Name = "MegaChips" ,
42
- Bytes = new byte [ ] { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 }
43
- } ) ;
44
-
45
- context . SaveChanges ( ) ;
46
- } ,
47
- context =>
48
- {
49
- var entry = context . ProductWithBytes . Attach (
50
- new ProductWithBytes
51
- {
52
- Id = productId ,
53
- Name = "MegaChips" ,
54
- Bytes = new byte [ ] { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 }
55
- } ) ;
56
-
57
- entry . Entity . Name = "GigaChips" ;
58
-
59
- Assert . Throws < DbUpdateConcurrencyException > (
60
- ( ) => context . SaveChanges ( ) ) ;
61
- } ,
62
- context =>
63
- {
64
- Assert . Equal ( "MegaChips" , context . ProductWithBytes . Find ( productId ) . Name ) ;
65
- } ) ;
66
-
67
- }
68
- finally
69
- {
70
- AppContext . SetSwitch ( "Microsoft.EntityFrameworkCore.Issue12214" , false ) ;
71
- }
72
- }
73
-
74
- [ Fact ]
75
- public virtual void Remove_on_bytes_concurrency_token_original_value_matches_throws_with_quirk ( )
76
- {
77
- var productId = Guid . NewGuid ( ) ;
78
-
79
- try
80
- {
81
- AppContext . SetSwitch ( "Microsoft.EntityFrameworkCore.Issue12214" , true ) ;
82
-
83
- ExecuteWithStrategyInTransaction (
84
- context =>
85
- {
86
- context . Add (
87
- new ProductWithBytes
88
- {
89
- Id = productId ,
90
- Name = "MegaChips" ,
91
- Bytes = new byte [ ] { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 }
92
- } ) ;
93
-
94
- context . SaveChanges ( ) ;
95
- } ,
96
- context =>
97
- {
98
- var entry = context . ProductWithBytes . Attach (
99
- new ProductWithBytes
100
- {
101
- Id = productId ,
102
- Name = "MegaChips" ,
103
- Bytes = new byte [ ] { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 }
104
- } ) ;
105
-
106
- entry . State = EntityState . Deleted ;
107
-
108
- Assert . Throws < DbUpdateConcurrencyException > (
109
- ( ) => context . SaveChanges ( ) ) ;
110
- } ,
111
- context =>
112
- {
113
- Assert . Equal ( "MegaChips" , context . ProductWithBytes . Find ( productId ) . Name ) ;
114
- } ) ;
115
-
116
- }
117
- finally
118
- {
119
- AppContext . SetSwitch ( "Microsoft.EntityFrameworkCore.Issue12214" , false ) ;
120
- }
121
- }
122
- #endif
123
-
124
19
protected override string UpdateConcurrencyMessage
125
20
=> InMemoryStrings . UpdateConcurrencyException ;
126
21
0 commit comments