public void cdnpathbuilder_dimensionsGuard_fail()
        {
            var fileMoq = new Mock<UploadcareFile>();
            fileMoq.Setup(x => x.FileId).Returns(new Guid(FILE_ID));

            _builder = new CdnPathBuilder(fileMoq.Object);

            _builder.Resize(1024, 634);
            _builder.Resize(634, 1024);
            try
            {
                _builder.Resize(1024, 635);
            }
            catch (ArgumentException)
            {
                try
                {
                    _builder.Resize(635, 1024);
                }
                catch (ArgumentException)
                {
                    Assert.True(true);
                }
            }
        }
        public void cdnpathbuilder_allOperations_assert()
        {
            var fileMoq = new Mock<UploadcareFile>();
            fileMoq.Setup(x => x.FileId).Returns(new Guid(FILE_ID));

            _builder = new CdnPathBuilder(fileMoq.Object);

            var path = _builder.Crop(100, 110).CropColor(120, 130, Color.Black).CropCenter(140, 150).CropCenterColor(160, 170, Color.Red).Resize(100, 110).ResizeWidth(120).ResizeHeight(130).ScaleCrop(100, 110).ScaleCropCenter(120, 130).Flip().Grayscale().Invert().Mirror().Build();
            Assert.Equal("/" + FILE_ID + "/-/crop/100x110" + "/-/crop/120x130/000000" + "/-/crop/140x150/center" + "/-/crop/160x170/center/ff0000" + "/-/resize/100x110" + "/-/resize/120x" + "/-/resize/x130" + "/-/scale_crop/100x110" + "/-/scale_crop/120x130/center" + "/-/effect/flip" + "/-/effect/grayscale" + "/-/effect/invert" + "/-/effect/mirror" + "/", path);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Creates a full CDN URL with a CDN path builder.
 /// </summary>
 /// <param name="builder"> Configured CDN path builder </param>
 public static Uri Cdn(CdnPathBuilder builder)
 {
     return(new Uri(CDN_BASE + builder.Build()));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Creates a full CDN URL with a CDN path builder.
 /// </summary>
 /// <param name="builder"> Configured CDN path builder </param>
 public static Uri Cdn(CdnPathBuilder builder)
 {
     return new Uri(CDN_BASE + builder.Build());
 }
        public void cdnpathbuilder_fileUrl_assert()
        {
            var fileMoq = new Mock<UploadcareFile>();
            fileMoq.Setup(x => x.FileId).Returns(new Guid(FILE_ID));

            _builder = new CdnPathBuilder(fileMoq.Object);
            var path = _builder.Build();
            Assert.Equal("/" + FILE_ID + "/", path);
        }