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

22 lines
717 B
C#
Raw Permalink Normal View History

using Roadie.Library.Utility;
2019-07-07 03:16:33 +00:00
using System.IO;
using System.Threading.Tasks;
2019-07-07 03:16:33 +00:00
using Xunit;
namespace Roadie.Library.Tests
{
public class WebHelperTests : HttpClientFactoryBaseTests
2019-07-07 03:16:33 +00:00
{
[Fact]
public async Task DownloadTestImage()
2019-07-07 03:16:33 +00:00
{
var testImageUrl = @"https://i.ytimg.com/vi/OiH5YMXQwYg/maxresdefault.jpg";
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);
}
}
}