using SharepointToolbox.Core.Helpers; namespace SharepointToolbox.Tests.Helpers; [Trait("Category", "Unit")] public class ExecuteQueryRetryHelperTests { [Theory] [InlineData("The request has been throttled -- 429")] [InlineData("Service unavailable 503")] [InlineData("SharePoint has throttled your request")] public void IsThrottleException_ThrottleMessages_ReturnsTrue(string message) { var ex = new Exception(message); Assert.True(ExecuteQueryRetryHelper.IsThrottleException(ex)); } [Fact] public void IsThrottleException_NonThrottleMessage_ReturnsFalse() { var ex = new Exception("File not found"); Assert.False(ExecuteQueryRetryHelper.IsThrottleException(ex)); } [Fact] public void IsThrottleException_NestedThrottleInInnerException_ReturnsFalse() { // Documents current behavior: only top-level Message is checked. // Inner exceptions with "429" are NOT currently detected. var ex = new Exception("outer", new Exception("429")); Assert.False(ExecuteQueryRetryHelper.IsThrottleException(ex)); } }