@@ -103,9 +103,21 @@ public virtual void Save_partial_update_on_concurrency_token_original_value_mism
103
103
[ Fact ]
104
104
public virtual void Update_on_bytes_concurrency_token_original_value_mismatch_throws ( )
105
105
{
106
- var productId = new Guid ( "984ade3c-2f7b-4651-a351-642e92ab7146" ) ;
106
+ var productId = Guid . NewGuid ( ) ;
107
107
108
108
ExecuteWithStrategyInTransaction (
109
+ context =>
110
+ {
111
+ context . Add (
112
+ new ProductWithBytes
113
+ {
114
+ Id = productId ,
115
+ Name = "MegaChips" ,
116
+ Bytes = new byte [ ] { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 }
117
+ } ) ;
118
+
119
+ context . SaveChanges ( ) ;
120
+ } ,
109
121
context =>
110
122
{
111
123
var entry = context . ProductWithBytes . Attach (
@@ -130,9 +142,21 @@ public virtual void Update_on_bytes_concurrency_token_original_value_mismatch_th
130
142
[ Fact ]
131
143
public virtual void Update_on_bytes_concurrency_token_original_value_matches_does_not_throw ( )
132
144
{
133
- var productId = new Guid ( "984ade3c-2f7b-4651-a351-642e92ab7146" ) ;
145
+ var productId = Guid . NewGuid ( ) ;
134
146
135
147
ExecuteWithStrategyInTransaction (
148
+ context =>
149
+ {
150
+ context . Add (
151
+ new ProductWithBytes
152
+ {
153
+ Id = productId ,
154
+ Name = "MegaChips" ,
155
+ Bytes = new byte [ ] { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 }
156
+ } ) ;
157
+
158
+ context . SaveChanges ( ) ;
159
+ } ,
136
160
context =>
137
161
{
138
162
var entry = context . ProductWithBytes . Attach (
@@ -156,9 +180,21 @@ public virtual void Update_on_bytes_concurrency_token_original_value_matches_doe
156
180
[ Fact ]
157
181
public virtual void Remove_on_bytes_concurrency_token_original_value_mismatch_throws ( )
158
182
{
159
- var productId = new Guid ( "984ade3c-2f7b-4651-a351-642e92ab7146" ) ;
183
+ var productId = Guid . NewGuid ( ) ;
160
184
161
185
ExecuteWithStrategyInTransaction (
186
+ context =>
187
+ {
188
+ context . Add (
189
+ new ProductWithBytes
190
+ {
191
+ Id = productId ,
192
+ Name = "MegaChips" ,
193
+ Bytes = new byte [ ] { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 }
194
+ } ) ;
195
+
196
+ context . SaveChanges ( ) ;
197
+ } ,
162
198
context =>
163
199
{
164
200
var entry = context . ProductWithBytes . Attach (
@@ -183,9 +219,21 @@ public virtual void Remove_on_bytes_concurrency_token_original_value_mismatch_th
183
219
[ Fact ]
184
220
public virtual void Remove_on_bytes_concurrency_token_original_value_matches_does_not_throw ( )
185
221
{
186
- var productId = new Guid ( "984ade3c-2f7b-4651-a351-642e92ab7146" ) ;
222
+ var productId = Guid . NewGuid ( ) ;
187
223
188
224
ExecuteWithStrategyInTransaction (
225
+ context =>
226
+ {
227
+ context . Add (
228
+ new ProductWithBytes
229
+ {
230
+ Id = productId ,
231
+ Name = "MegaChips" ,
232
+ Bytes = new byte [ ] { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 }
233
+ } ) ;
234
+
235
+ context . SaveChanges ( ) ;
236
+ } ,
189
237
context =>
190
238
{
191
239
var entry = context . ProductWithBytes . Attach (
@@ -454,17 +502,19 @@ public Task SaveChangesAsync_false_processes_all_tracked_entities_without_callin
454
502
455
503
protected virtual void ExecuteWithStrategyInTransaction (
456
504
Action < UpdatesContext > testOperation ,
457
- Action < UpdatesContext > nestedTestOperation1 = null )
505
+ Action < UpdatesContext > nestedTestOperation1 = null ,
506
+ Action < UpdatesContext > nestedTestOperation2 = null )
458
507
=> TestHelpers . ExecuteWithStrategyInTransaction (
459
508
CreateContext , UseTransaction ,
460
- testOperation , nestedTestOperation1 ) ;
509
+ testOperation , nestedTestOperation1 , nestedTestOperation2 ) ;
461
510
462
511
protected virtual Task ExecuteWithStrategyInTransactionAsync (
463
512
Func < UpdatesContext , Task > testOperation ,
464
- Func < UpdatesContext , Task > nestedTestOperation1 = null )
513
+ Func < UpdatesContext , Task > nestedTestOperation1 = null ,
514
+ Func < UpdatesContext , Task > nestedTestOperation2 = null )
465
515
=> TestHelpers . ExecuteWithStrategyInTransactionAsync (
466
516
CreateContext , UseTransaction ,
467
- testOperation , nestedTestOperation1 ) ;
517
+ testOperation , nestedTestOperation1 , nestedTestOperation2 ) ;
468
518
469
519
protected virtual void UseTransaction ( DatabaseFacade facade , IDbContextTransaction transaction )
470
520
{
0 commit comments