diff --git a/src/IO.Ably.Tests.Shared/Rest/RestSpecs.cs b/src/IO.Ably.Tests.Shared/Rest/RestSpecs.cs index f492b097c..08a112fec 100644 --- a/src/IO.Ably.Tests.Shared/Rest/RestSpecs.cs +++ b/src/IO.Ably.Tests.Shared/Rest/RestSpecs.cs @@ -604,6 +604,35 @@ public async Task ShouldUseCustomFallbackHostIfProvided() attemptedList[1].Should().Be("www.example.com"); } + [Fact] + [Trait("spec", "RSC15a")] + [Trait("spec", "TO3k6")] + public async Task ShouldUseCustomFallbackHostIfProvidedAndDefaultHostIsDifferent() + { + _response.StatusCode = HttpStatusCode.BadGateway; + var attemptedList = new List(); + var fallbackHosts = new[] + { + "www.example1.com", + "www.example2.com", + "www.example3.com", + "www.example4.com", + "www.example5.com" + }; + var client = CreateClient(options => + { + options.RestHost = "www.primaryhost.com"; + options.FallbackHosts = fallbackHosts; + options.HttpMaxRetryCount = 5; + }); + await Assert.ThrowsAsync(() => MakeAnyRequest(client)); + attemptedList.AddRange(_handler.Requests.Select(x => x.RequestUri.Host).ToList()); + + attemptedList.Count.Should().Be(6); + attemptedList[0].Should().Be("www.primaryhost.com"); + attemptedList.Skip(1).IsSubsetOf(fallbackHosts).Should().BeTrue(); + } + [Fact] [Trait("spec", "RSC15a")] [Trait("spec", "TO3k6")]