Skip to content

Commit 4acfce4

Browse files
committed
Setting maximum retry count at 5
1 parent 0d1c944 commit 4acfce4

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/SendGrid/Reliability/ReliabilitySettings.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ public int RetryCount
3636
throw new ArgumentException("Retry count must be greater than zero");
3737
}
3838

39+
if (value > 5)
40+
{
41+
throw new ArgumentException("Retry count must be less than 5");
42+
}
43+
3944
retryCount = value;
4045
}
4146
}

tests/SendGrid.Tests/Reliability/RetryDelegatingHandlerTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,14 @@ public void ReliabilitySettingsShouldNotAllowNegativeRetryCount()
100100
Assert.Throws<ArgumentException>(() => settings.RetryCount = -1);
101101
}
102102

103+
[Fact]
104+
public void ReliabilitySettingsShouldNotAllowRetryCountGreaterThan5()
105+
{
106+
var settings = new ReliabilitySettings();
107+
108+
Assert.Throws<ArgumentException>(() => settings.RetryCount = 6);
109+
}
110+
103111
[Fact]
104112
public void ReliabilitySettingsShouldNotAllowRetryIntervalGreaterThan30Seconds()
105113
{

0 commit comments

Comments
 (0)