Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
2 changes: 1 addition & 1 deletion src/Polly.Specs/Bulkhead/BulkheadAsyncSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void Should_call_onBulkheadRejected_with_passed_context()

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

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

cancellationSource.Cancel();
tcs.SetCanceled();
Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Specs/Bulkhead/BulkheadTResultAsyncSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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>();
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