Skip to content

Commit

Permalink
Fix Infer ConfigureAwait test warnings (#403)
Browse files Browse the repository at this point in the history
* rem

* more

---------
  • Loading branch information
bitfaster authored Oct 3, 2023
1 parent 822e160 commit 43281dd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions BitFaster.Caching.UnitTests/Lfu/ConcurrentLfuTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public void WhenKeyIsRequestedWithArgItIsCreatedAndCached()
[Fact]
public async Task WhenKeyIsRequesteItIsCreatedAndCachedAsync()
{
var result1 = await cache.GetOrAddAsync(1, valueFactory.CreateAsync).ConfigureAwait(false);
var result2 = await cache.GetOrAddAsync(1, valueFactory.CreateAsync).ConfigureAwait(false);
var result1 = await cache.GetOrAddAsync(1, valueFactory.CreateAsync);
var result2 = await cache.GetOrAddAsync(1, valueFactory.CreateAsync);

valueFactory.timesCalled.Should().Be(1);
result1.Should().Be(result2);
Expand All @@ -66,8 +66,8 @@ public async Task WhenKeyIsRequesteItIsCreatedAndCachedAsync()
[Fact]
public async Task WhenKeyIsRequestedWithArgItIsCreatedAndCachedAsync()
{
var result1 = await cache.GetOrAddAsync(1, valueFactory.CreateAsync, 9).ConfigureAwait(false);
var result2 = await cache.GetOrAddAsync(1, valueFactory.CreateAsync, 17).ConfigureAwait(false);
var result1 = await cache.GetOrAddAsync(1, valueFactory.CreateAsync, 9);
var result2 = await cache.GetOrAddAsync(1, valueFactory.CreateAsync, 17);

valueFactory.timesCalled.Should().Be(1);
result1.Should().Be(result2);
Expand Down
12 changes: 6 additions & 6 deletions BitFaster.Caching.UnitTests/Lru/ClassicLruTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ public void WhenKeyIsRequestedWithArgItIsCreatedAndCached()
[Fact]
public async Task WhenKeyIsRequesteItIsCreatedAndCachedAsync()
{
var result1 = await lru.GetOrAddAsync(1, valueFactory.CreateAsync).ConfigureAwait(false);
var result2 = await lru.GetOrAddAsync(1, valueFactory.CreateAsync).ConfigureAwait(false);
var result1 = await lru.GetOrAddAsync(1, valueFactory.CreateAsync);
var result2 = await lru.GetOrAddAsync(1, valueFactory.CreateAsync);

valueFactory.timesCalled.Should().Be(1);
result1.Should().Be(result2);
Expand All @@ -205,8 +205,8 @@ public async Task WhenKeyIsRequesteItIsCreatedAndCachedAsync()
[Fact]
public async Task WhenKeyIsRequestedWithArgItIsCreatedAndCachedAsync()
{
var result1 = await lru.GetOrAddAsync(1, valueFactory.CreateAsync, "x").ConfigureAwait(false);
var result2 = await lru.GetOrAddAsync(1, valueFactory.CreateAsync, "y").ConfigureAwait(false);
var result1 = await lru.GetOrAddAsync(1, valueFactory.CreateAsync, "x");
var result2 = await lru.GetOrAddAsync(1, valueFactory.CreateAsync, "y");

valueFactory.timesCalled.Should().Be(1);
result1.Should().Be(result2);
Expand All @@ -227,8 +227,8 @@ public void WhenDifferentKeysAreRequestedValueIsCreatedForEach()
[Fact]
public async Task WhenDifferentKeysAreRequesteValueIsCreatedForEachAsync()
{
var result1 = await lru.GetOrAddAsync(1, valueFactory.CreateAsync).ConfigureAwait(false);
var result2 = await lru.GetOrAddAsync(2, valueFactory.CreateAsync).ConfigureAwait(false);
var result1 = await lru.GetOrAddAsync(1, valueFactory.CreateAsync);
var result2 = await lru.GetOrAddAsync(2, valueFactory.CreateAsync);

valueFactory.timesCalled.Should().Be(2);

Expand Down
14 changes: 7 additions & 7 deletions BitFaster.Caching.UnitTests/Lru/ConcurrentLruTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void WhenItemIsAddedCountIsCorrect()
public async Task WhenItemIsAddedCountIsCorrectAsync()
{
lru.Count.Should().Be(0);
await lru.GetOrAddAsync(0, valueFactory.CreateAsync).ConfigureAwait(false);
await lru.GetOrAddAsync(0, valueFactory.CreateAsync);
lru.Count.Should().Be(1);
}

Expand Down Expand Up @@ -261,8 +261,8 @@ public void WhenKeyIsRequestedWithArgItIsCreatedAndCached()
[Fact]
public async Task WhenKeyIsRequestedItIsCreatedAndCachedAsync()
{
var result1 = await lru.GetOrAddAsync(1, valueFactory.CreateAsync).ConfigureAwait(false);
var result2 = await lru.GetOrAddAsync(1, valueFactory.CreateAsync).ConfigureAwait(false);
var result1 = await lru.GetOrAddAsync(1, valueFactory.CreateAsync);
var result2 = await lru.GetOrAddAsync(1, valueFactory.CreateAsync);

valueFactory.timesCalled.Should().Be(1);
result1.Should().Be(result2);
Expand All @@ -271,8 +271,8 @@ public async Task WhenKeyIsRequestedItIsCreatedAndCachedAsync()
[Fact]
public async Task WhenKeyIsRequestedWithArgItIsCreatedAndCachedAsync()
{
var result1 = await lru.GetOrAddAsync(1, valueFactory.CreateAsync, "x").ConfigureAwait(false);
var result2 = await lru.GetOrAddAsync(1, valueFactory.CreateAsync, "y").ConfigureAwait(false);
var result1 = await lru.GetOrAddAsync(1, valueFactory.CreateAsync, "x");
var result2 = await lru.GetOrAddAsync(1, valueFactory.CreateAsync, "y");

valueFactory.timesCalled.Should().Be(1);
result1.Should().Be(result2);
Expand All @@ -293,8 +293,8 @@ public void WhenDifferentKeysAreRequestedValueIsCreatedForEach()
[Fact]
public async Task WhenDifferentKeysAreRequesteValueIsCreatedForEachAsync()
{
var result1 = await lru.GetOrAddAsync(1, valueFactory.CreateAsync).ConfigureAwait(false);
var result2 = await lru.GetOrAddAsync(2, valueFactory.CreateAsync).ConfigureAwait(false);
var result1 = await lru.GetOrAddAsync(1, valueFactory.CreateAsync);
var result2 = await lru.GetOrAddAsync(2, valueFactory.CreateAsync);

valueFactory.timesCalled.Should().Be(2);

Expand Down

0 comments on commit 43281dd

Please sign in to comment.