2022-01-17 20:03:52 +00:00
|
|
|
|
using Roadie.Library.Utility;
|
2019-07-07 03:16:33 +00:00
|
|
|
|
using System.IO;
|
2022-01-17 20:03:52 +00:00
|
|
|
|
using System.Threading.Tasks;
|
2019-07-07 03:16:33 +00:00
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
namespace Roadie.Library.Tests
|
|
|
|
|
{
|
2022-01-17 20:03:52 +00:00
|
|
|
|
public class WebHelperTests : HttpClientFactoryBaseTests
|
2019-07-07 03:16:33 +00:00
|
|
|
|
{
|
|
|
|
|
[Fact]
|
2022-01-17 20:03:52 +00:00
|
|
|
|
public async Task DownloadTestImage()
|
2019-07-07 03:16:33 +00:00
|
|
|
|
{
|
|
|
|
|
var testImageUrl = @"https://i.ytimg.com/vi/OiH5YMXQwYg/maxresdefault.jpg";
|
2022-01-17 20:03:52 +00:00
|
|
|
|
var imageBytes = await WebHelper.BytesForImageUrl(_httpClientFactory, testImageUrl).ConfigureAwait(false);
|
2019-07-07 03:16:33 +00:00
|
|
|
|
Assert.NotNull(imageBytes);
|
|
|
|
|
Assert.NotEmpty(imageBytes);
|
|
|
|
|
|
|
|
|
|
var coverFileName = Path.Combine(@"C:\roadie_dev_root", "testImage.jpg");
|
|
|
|
|
File.WriteAllBytes(coverFileName, imageBytes);
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-01-17 20:03:52 +00:00
|
|
|
|
}
|