public void HostFallbackTest() { var service = new TestImgAzyobuziNet(new[] { "http://down.example.com/api/", "http://avail.example.com/api/" }); service.LoadRegex(); Assert.That(service.GetApiBase(), Is.EqualTo("http://avail.example.com/api/")); }
public async Task HostFallbackTest() { var service = new TestImgAzyobuziNet(new[] { "http://avail1.example.com/api/", "http://avail2.example.com/api/" }); await service.LoadRegexAsync(); Assert.Equal("http://avail1.example.com/api/", service.GetApiBase()); service = new TestImgAzyobuziNet(new[] { "http://down.example.com/api/", "http://avail.example.com/api/" }); await service.LoadRegexAsync(); Assert.Equal("http://avail.example.com/api/", service.GetApiBase()); service = new TestImgAzyobuziNet(new[] { "http://error.example.com/api/", "http://avail.example.com/api/" }); await service.LoadRegexAsync(); Assert.Equal("http://avail.example.com/api/", service.GetApiBase()); service = new TestImgAzyobuziNet(new[] { "http://invalid.example.com/api/", "http://avail.example.com/api/" }); await service.LoadRegexAsync(); Assert.Equal("http://avail.example.com/api/", service.GetApiBase()); service = new TestImgAzyobuziNet(new[] { "http://down.example.com/api/" }); await service.LoadRegexAsync(); Assert.Null(service.GetApiBase()); }
public void ServerOutageTest() { var service = new TestImgAzyobuziNet(new[] { "http://down.example.com/api/" }); service.LoadRegex(); Assert.That(service.GetApiBase(), Is.Null); var thumbinfo = service.GetThumbnailInfo("http://example.com/abcd", null); Assert.That(thumbinfo, Is.Null); }
public async Task ServerOutageTest() { var service = new TestImgAzyobuziNet(new[] { "http://down.example.com/api/" }); await service.LoadRegexAsync(); Assert.Null(service.GetApiBase()); var thumbinfo = await service.GetThumbnailInfoAsync("http://example.com/abcd", null, CancellationToken.None); Assert.Null(thumbinfo); }
public void HostFallbackTest() { var service = new TestImgAzyobuziNet(new[] { "http://avail1.example.com/api/", "http://avail2.example.com/api/" }); service.LoadRegex(); Assert.That(service.GetApiBase(), Is.EqualTo("http://avail1.example.com/api/")); service = new TestImgAzyobuziNet(new[] { "http://down.example.com/api/", "http://avail.example.com/api/" }); service.LoadRegex(); Assert.That(service.GetApiBase(), Is.EqualTo("http://avail.example.com/api/")); service = new TestImgAzyobuziNet(new[] { "http://error.example.com/api/", "http://avail.example.com/api/" }); service.LoadRegex(); Assert.That(service.GetApiBase(), Is.EqualTo("http://avail.example.com/api/")); service = new TestImgAzyobuziNet(new[] { "http://invalid.example.com/api/", "http://avail.example.com/api/" }); service.LoadRegex(); Assert.That(service.GetApiBase(), Is.EqualTo("http://avail.example.com/api/")); service = new TestImgAzyobuziNet(new[] { "http://down.example.com/api/" }); service.LoadRegex(); Assert.That(service.GetApiBase(), Is.Null); }