roadie/Roadie.Api.Library.Tests/WebHelperTests.cs

22 lines
No EOL
717 B
C#

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