-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve CA1032 warnings.
- Loading branch information
Showing
5 changed files
with
103 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
test/Polly.Specs/RateLimit/RateLimitRejectedExceptionTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
namespace Polly.Specs.RateLimit; | ||
|
||
public class RateLimitRejectedExceptionTests | ||
{ | ||
[Fact] | ||
public void Ctor_Ok() | ||
{ | ||
const string Dummy = "dummy"; | ||
var exception = new InvalidOperationException(); | ||
var retryAfter = TimeSpan.FromSeconds(4); | ||
|
||
new RateLimitRejectedException().Message.Should().Be("The operation could not be executed because it was rejected by the rate limit."); | ||
new RateLimitRejectedException(Dummy).Message.Should().Be(Dummy); | ||
|
||
var rate = new RateLimitRejectedException(Dummy, exception); | ||
rate.Message.Should().Be(Dummy); | ||
rate.InnerException.Should().Be(exception); | ||
|
||
new RateLimitRejectedException(retryAfter).RetryAfter.Should().Be(retryAfter); | ||
new RateLimitRejectedException(retryAfter).Message.Should().Be($"The operation has been rate-limited and should be retried after {retryAfter}"); | ||
|
||
rate = new RateLimitRejectedException(retryAfter, exception); | ||
rate.RetryAfter.Should().Be(retryAfter); | ||
rate.InnerException.Should().Be(exception); | ||
|
||
rate = new RateLimitRejectedException(retryAfter, Dummy); | ||
rate.RetryAfter.Should().Be(retryAfter); | ||
rate.Message.Should().Be(Dummy); | ||
|
||
rate = new RateLimitRejectedException(retryAfter, Dummy, exception); | ||
rate.RetryAfter.Should().Be(retryAfter); | ||
rate.Message.Should().Be(Dummy); | ||
rate.InnerException.Should().Be(exception); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace Polly.Specs.Utilities; | ||
|
||
public class LockTimeoutExceptionTests | ||
{ | ||
[Fact] | ||
public void Ctor_Ok() | ||
{ | ||
const string Dummy = "dummy"; | ||
var exception = new InvalidOperationException(); | ||
|
||
new LockTimeoutException().Message.Should().Be("Timeout waiting for lock"); | ||
new LockTimeoutException(Dummy).Message.Should().Be(Dummy); | ||
|
||
var rate = new LockTimeoutException(Dummy, exception); | ||
rate.Message.Should().Be(Dummy); | ||
rate.InnerException.Should().Be(exception); | ||
} | ||
} |