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);
        }
Exemple #2
0
        private FileEntity ProcessFileInfo(FileInfo fileInfo)
        {
            var fileEntity = new FileEntity
            {
                FileId      = fileInfo.FileId,
                Description = fileInfo.Description,
            };

            if (string.IsNullOrEmpty(fileEntity.Url) && !string.IsNullOrEmpty(fileInfo.FileId))
            {
                fileEntity.Url = CdnPathBuilder.Build(fileInfo.FileId).ToString();
            }
            else
            {
                fileEntity.Url = fileInfo.Url;
            }

            return(fileEntity);
        }