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 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 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 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); }