예제 #1
0
        public async Task UploadFileNoParametersAndRemove()
        {
            string path          = GetExampleImage();
            var    responseMaybe = await _client.UploadFile(path).ConfigureAwait(false);

            Assert.IsTrue(responseMaybe.HasValue);
            var response = responseMaybe.Value;

            Assert.NotNull(response);
            Assert.IsNotEmpty(response.Url);
            Assert.IsNull(response.AlbumId);
            Assert.IsTrue(response.IsPublic);
            await _client.RemoveFile(response.PublicId);
        }
예제 #2
0
        public async Task CreateAndAuthenticate()
        {
            _client = new CdnClient(Constants.BaseUrl);
            var resp = await _client.Login("admin", "password");

            Assert.IsTrue(resp.HasValue);
            Assert.IsNotEmpty(resp.Value.Token);

            // Upload files to be used in further tests
            _uploadedFiles = (await this.UploadMultipleFilesNoParameters().ConfigureAwait(false)).ToList();
            // Upload one private file
            var file = await _client.UploadFile(FileUploadTests.GetExampleImage(), "privateTestfile", false);

            Assert.IsTrue(file.HasValue);
            Assert.NotNull(file.Value);
            _uploadedFiles.Add(file.Value);
            Assert.IsNotEmpty(_uploadedFiles);
        }