Skip to content

Commit f6d5c34

Browse files
committed
test(patch): use non-cached context
otherwise the todoItem.OwnerId will be null from the cached version
1 parent 3143e4a commit f6d5c34

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/JsonApiDotNetCoreExampleTests/Acceptance/Spec/UpdatingDataTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using JsonApiDotNetCoreExample.Models;
1212
using Microsoft.AspNetCore.Hosting;
1313
using Microsoft.AspNetCore.TestHost;
14+
using Microsoft.EntityFrameworkCore;
1415
using Newtonsoft.Json;
1516
using Xunit;
1617
using Person = JsonApiDotNetCoreExample.Models.Person;
@@ -124,7 +125,8 @@ public async Task Can_Patch_Entity_And_HasOne_Relationships()
124125

125126
// Act
126127
var response = await client.SendAsync(request);
127-
var updatedTodoItem = _context.TodoItems
128+
var updatedTodoItem = _context.TodoItems.AsNoTracking()
129+
.Include(t => t.Owner)
128130
.SingleOrDefault(t => t.Id == todoItem.Id);
129131

130132
// Assert

0 commit comments

Comments
 (0)