예제 #1
0
        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);
        }
예제 #2
0
        public void CompressionShouldThrowIfNoUrlToFile()
        {
            var pngx = new TinyPngClient(apiKey, new HttpClient(new FakeResponseHandler().Compress()));

            Assert.ThrowsAsync <ArgumentNullException>(async() => await pngx.CompressFromUrl(string.Empty));
        }