public async Task CompressionFromUrl() { var pngx = new TinyPngClient(apiKey, new HttpClient(new FakeResponseHandler().Compress())); var result = await pngx.CompressFromUrl("https://sample.com/image.jpg"); Assert.Equal("image/jpeg", result.Input.Type); Assert.Equal(400, result.Output.Width); Assert.Equal(400, result.Output.Height); }
public void CompressionShouldThrowIfNoUrlToFile() { var pngx = new TinyPngClient(apiKey, new HttpClient(new FakeResponseHandler().Compress())); Assert.ThrowsAsync <ArgumentNullException>(async() => await pngx.CompressFromUrl(string.Empty)); }