Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1a5e00c
Bump version to 7.3.1
martincostello Jan 17, 2022
dfa9040
Change version to 7.2.4
martincostello Jan 17, 2022
ac01478
Add RateLimit benchmarks (#910)
martincostello Jan 17, 2022
9d13eac
Fixed an incorrect exception argument (#915)
FoxTes Feb 3, 2022
9d7d8bc
Upgrade FluentAssertions (#918)
dotnetspark Feb 13, 2022
3cbef2b
Add code coverage (#919)
martincostello Feb 13, 2022
98f7429
Add Visual Studio Code config files
martincostello Feb 13, 2022
c36712e
Bump Cake to v2.0.0 (#921)
eugeneogongo Feb 13, 2022
9f2c129
Tidy up build scripts
martincostello Feb 13, 2022
50b723b
Set executable bit
martincostello Feb 13, 2022
9f8d370
Disable download progress
martincostello Feb 13, 2022
475b7ba
Skip net4xx tests on non-Windows
martincostello Feb 13, 2022
47a2b5d
Drop test target for netcoreapp2.1
martincostello Feb 13, 2022
440955d
Speed up CI
martincostello Feb 13, 2022
28ebb94
Fix NullReferenceException (#923)
FoxTes Feb 14, 2022
e327306
Use file-scoped namespaces
martincostello Dec 16, 2022
053d891
Create .git-blame-ignore-revs
martincostello Dec 16, 2022
80002fe
Revert "expression body members"
martincostello Dec 16, 2022
63b151e
Revert "file scoped namespaces"
martincostello Dec 16, 2022
a792446
Revert "use var"
martincostello Dec 16, 2022
78c9860
Merge branch 'v724-or-v730' into undo-syntax-changes
martincostello Dec 16, 2022
35cf357
Update .git-blame-ignore-revs
martincostello Dec 16, 2022
b08876b
Add GitHub Actions CI
martincostello Dec 16, 2022
6f4d997
Add build matrix
martincostello Dec 16, 2022
1073e82
Remove macOS and Linux
martincostello Dec 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Upgrade FluentAssertions (#918)
* Upgrade FluentAssertions package

* Fix broken test

* Async all the things

Await all usages of Awaiting().

Co-authored-by: martincostello <martin@martincostello.com>
  • Loading branch information
dotnetspark and martincostello authored Feb 13, 2022
commit 9d7d8bc6be8eaed8c685908f8e00e55190437e9c
6 changes: 3 additions & 3 deletions src/Polly.Specs/Bulkhead/BulkheadAsyncSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void Should_throw_when_onBulkheadRejected_is_null()
#region onBulkheadRejected delegate

[Fact]
public void Should_call_onBulkheadRejected_with_passed_context()
public async Task Should_call_onBulkheadRejected_with_passed_context()
{
string operationKey = "SomeKey";
Context contextPassedToExecute = new Context(operationKey);
Expand All @@ -65,11 +65,11 @@ public void Should_call_onBulkheadRejected_with_passed_context()
TaskCompletionSource<object> tcs = new TaskCompletionSource<object>();
using (CancellationTokenSource cancellationSource = new CancellationTokenSource())
{
Task.Run(() => { bulkhead.ExecuteAsync(async () => { await tcs.Task; }); });
_ = Task.Run(() => { bulkhead.ExecuteAsync(async () => { await tcs.Task; }); });

Within(CohesionTimeLimit, () => Expect(0, () => bulkhead.BulkheadAvailableCount, nameof(bulkhead.BulkheadAvailableCount)));

bulkhead.Awaiting(b => b.ExecuteAsync(_ => TaskHelper.EmptyTask, contextPassedToExecute)).Should().Throw<BulkheadRejectedException>();
await bulkhead.Awaiting(b => b.ExecuteAsync(_ => TaskHelper.EmptyTask, contextPassedToExecute)).Should().ThrowAsync<BulkheadRejectedException>();

cancellationSource.Cancel();
tcs.SetCanceled();
Expand Down
6 changes: 3 additions & 3 deletions src/Polly.Specs/Bulkhead/BulkheadTResultAsyncSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void Should_throw_when_onBulkheadRejected_is_null()
#region onBulkheadRejected delegate

[Fact]
public void Should_call_onBulkheadRejected_with_passed_context()
public async Task Should_call_onBulkheadRejected_with_passed_context()
{
string operationKey = "SomeKey";
Context contextPassedToExecute = new Context(operationKey);
Expand All @@ -66,7 +66,7 @@ public void Should_call_onBulkheadRejected_with_passed_context()
TaskCompletionSource<object> tcs = new TaskCompletionSource<object>();
using (CancellationTokenSource cancellationSource = new CancellationTokenSource())
{
Task.Run(() => {
_ = Task.Run(() => {
bulkhead.ExecuteAsync(async () =>
{
await tcs.Task;
Expand All @@ -76,7 +76,7 @@ public void Should_call_onBulkheadRejected_with_passed_context()

Within(CohesionTimeLimit, () => Expect(0, () => bulkhead.BulkheadAvailableCount, nameof(bulkhead.BulkheadAvailableCount)));

bulkhead.Awaiting(b => b.ExecuteAsync(_ => Task.FromResult(1), contextPassedToExecute)).Should().Throw<BulkheadRejectedException>();
await bulkhead.Awaiting(b => b.ExecuteAsync(_ => Task.FromResult(1), contextPassedToExecute)).Should().ThrowAsync<BulkheadRejectedException>();

cancellationSource.Cancel();
tcs.SetCanceled();
Expand Down
8 changes: 4 additions & 4 deletions src/Polly.Specs/Caching/CacheAsyncSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,8 @@ public async Task Should_honour_cancellation_even_if_prior_execution_has_cached(

tokenSource.Cancel();

cache.Awaiting(policy => policy.ExecuteAsync(func, new Context(operationKey), tokenSource.Token))
.Should().Throw<OperationCanceledException>();
await cache.Awaiting(policy => policy.ExecuteAsync(func, new Context(operationKey), tokenSource.Token))
.Should().ThrowAsync<OperationCanceledException>();
delegateInvocations.Should().Be(1);
}

Expand All @@ -499,8 +499,8 @@ public async Task Should_honour_cancellation_during_delegate_execution_and_not_p
return valueToReturn;
};

cache.Awaiting(policy => policy.ExecuteAsync(func, new Context(operationKey), tokenSource.Token))
.Should().Throw<OperationCanceledException>();
await cache.Awaiting(policy => policy.ExecuteAsync(func, new Context(operationKey), tokenSource.Token))
.Should().ThrowAsync<OperationCanceledException>();

(bool cacheHit, object fromCache) = await stubCacheProvider.TryGetAsync(operationKey, CancellationToken.None, false);
cacheHit.Should().BeFalse();
Expand Down
8 changes: 4 additions & 4 deletions src/Polly.Specs/Caching/CacheTResultAsyncSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,8 @@ public async Task Should_honour_cancellation_even_if_prior_execution_has_cached(

tokenSource.Cancel();

cache.Awaiting(policy => policy.ExecuteAsync(func, new Context(operationKey), tokenSource.Token))
.Should().Throw<OperationCanceledException>();
await cache.Awaiting(policy => policy.ExecuteAsync(func, new Context(operationKey), tokenSource.Token))
.Should().ThrowAsync<OperationCanceledException>();
delegateInvocations.Should().Be(1);
}

Expand All @@ -483,8 +483,8 @@ public async Task Should_honour_cancellation_during_delegate_execution_and_not_p
return valueToReturn;
};

cache.Awaiting(policy => policy.ExecuteAsync(func, new Context(operationKey), tokenSource.Token))
.Should().Throw<OperationCanceledException>();
await cache.Awaiting(policy => policy.ExecuteAsync(func, new Context(operationKey), tokenSource.Token))
.Should().ThrowAsync<OperationCanceledException>();

(bool cacheHit, object fromCache) = await stubCacheProvider.TryGetAsync(operationKey, CancellationToken.None, false);
cacheHit.Should().BeFalse();
Expand Down
4 changes: 2 additions & 2 deletions src/Polly.Specs/Caching/RelativeTtlSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void Should_return_configured_timespan()
RelativeTtl ttlStrategy = new RelativeTtl(ttl);

Ttl retrieved = ttlStrategy.GetTtl(new Context("someOperationKey"), null);
retrieved.Timespan.Should().BeCloseTo(ttl);
retrieved.Timespan.Should().BeCloseTo(ttl, TimeSpan.Zero);
retrieved.SlidingExpiration.Should().BeFalse();
}

Expand All @@ -56,7 +56,7 @@ public void Should_return_configured_timespan_from_time_requested()
SystemClock.DateTimeOffsetUtcNow = () => fixedTime.Add(delay);

Ttl retrieved = ttlStrategy.GetTtl(new Context("someOperationKey"), null);
retrieved.Timespan.Should().BeCloseTo(ttl);
retrieved.Timespan.Should().BeCloseTo(ttl, TimeSpan.Zero);
retrieved.SlidingExpiration.Should().BeFalse();
}
}
Expand Down
Loading