Skip to content

Commit

Permalink
Fixed Flacky DataLoader test
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelstaib committed Feb 23, 2024
1 parent 6785dd3 commit 3891477
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/GreenDonut/test/Core.Tests/TaskCacheOwnerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ public class TaskCacheOwnerTests
public void EnsureTaskCacheIsReused()
{
// arrange
var cacheOwner1 = new TaskCacheOwner();
var pool = TaskCachePool.Create();
var cacheOwner1 = new TaskCacheOwner(pool);
var cache = cacheOwner1.Cache;
cacheOwner1.Dispose();

// act
using var cacheOwner2 = new TaskCacheOwner();
using var cacheOwner2 = new TaskCacheOwner(pool);

// assert
Assert.Same(cache, cacheOwner2.Cache);
Expand All @@ -23,9 +24,11 @@ public void EnsureTaskCacheIsReused()
public void EnsureNewCachesAreIssued()
{
// arrange
var pool = TaskCachePool.Create();

// act
using var cacheOwner1 = new TaskCacheOwner();
using var cacheOwner2 = new TaskCacheOwner();
using var cacheOwner1 = new TaskCacheOwner(pool);
using var cacheOwner2 = new TaskCacheOwner(pool);

// assert
Assert.NotSame(cacheOwner1.Cache, cacheOwner2.Cache);
Expand Down

0 comments on commit 3891477

Please sign in to comment.