Class BackgroundServiceRetryDelayTests
- Namespace
- ProjectTemplate.Web.Tests
- Assembly
- ProjectTemplate.Web.Tests.dll
Verifies the retry delay applied by the audit background services after consecutive failures.
public sealed class BackgroundServiceRetryDelayTests
- Inheritance
-
BackgroundServiceRetryDelayTests
- Inherited Members
Methods
Calculate_ConsecutiveFailures_DoublesDelay(int, double)
Verifies that the delay doubles for each additional consecutive failure.
[Theory("/home/runner/work/NetCoreApplicationTemplate/NetCoreApplicationTemplate/tests/ProjectTemplate.Web.Tests/BackgroundServiceRetryDelayTests.cs", 27)]
[InlineData(new object?[] { 1, 5 })]
[InlineData(new object?[] { 2, 10 })]
[InlineData(new object?[] { 3, 20 })]
[InlineData(new object?[] { 4, 40 })]
public void Calculate_ConsecutiveFailures_DoublesDelay(int consecutiveFailureCount, double expectedSeconds)
Parameters
consecutiveFailureCountintThe number of consecutive failed cycles.
expectedSecondsdoubleThe expected delay in seconds.
Calculate_InvalidArguments_Throw()
Verifies that invalid arguments are rejected.
[Fact("/home/runner/work/NetCoreApplicationTemplate/NetCoreApplicationTemplate/tests/ProjectTemplate.Web.Tests/BackgroundServiceRetryDelayTests.cs", 70)]
public void Calculate_InvalidArguments_Throw()
Calculate_LongOutage_IsCappedAtMaximumRetryDelay()
Verifies that the delay is capped at the configured maximum.
[Fact("/home/runner/work/NetCoreApplicationTemplate/NetCoreApplicationTemplate/tests/ProjectTemplate.Web.Tests/BackgroundServiceRetryDelayTests.cs", 45)]
public void Calculate_LongOutage_IsCappedAtMaximumRetryDelay()
Calculate_MaximumBelowInterval_UsesInterval()
Verifies that a maximum below the interval never shortens the configured interval.
[Fact("/home/runner/work/NetCoreApplicationTemplate/NetCoreApplicationTemplate/tests/ProjectTemplate.Web.Tests/BackgroundServiceRetryDelayTests.cs", 59)]
public void Calculate_MaximumBelowInterval_UsesInterval()
Calculate_NoFailures_ReturnsInterval()
Verifies that a successful cycle keeps the configured interval.
[Fact("/home/runner/work/NetCoreApplicationTemplate/NetCoreApplicationTemplate/tests/ProjectTemplate.Web.Tests/BackgroundServiceRetryDelayTests.cs", 16)]
public void Calculate_NoFailures_ReturnsInterval()