Ejemplo n.º 1
0
        public void DeleteFile_BadRequest()
        {
            var repo = new AdvertRepo(appContext);

            JObject result = repo.DeleteFromStorage("98b9adf1-7019-4236-9d06-0bc7cecdc9e3");

            int status = (int)result.Property("status").Value;

            Assert.Equal(400, status);
        }
Ejemplo n.º 2
0
        public void DeleteFile()
        {
            var repo = new AdvertRepo(appContext);

            JObject result = repo.DeleteFromStorage("57ef964b-6fa4-44f9-b019-f1622ace0587");

            string uuid   = result.Property("uuid").Value.ToString();
            string url    = result.Property("url").Value.ToString();
            int    status = (int)result.Property("status").Value;

            Assert.Equal(200, status);
            Assert.Equal("57ef964b-6fa4-44f9-b019-f1622ace0587", uuid);
            Assert.Equal("https://api.uploadcare.com/files/57ef964b-6fa4-44f9-b019-f1622ace0587/", url);
        }
Ejemplo n.º 3
0
        public void DeleteBatch_Successs()
        {
            var           repo  = new AdvertRepo(appContext);
            List <string> files = new List <string>
            {
                "07fac068-1eb8-4b32-92a4-96bf40d9f9d8",
                "624f9274-f568-484b-8f13-aed558d742b1"
            };

            JObject result = repo.DeleteFromStorage(files);

            string status  = result.Property("status").Value.ToString();
            JArray results = (JArray)result.Property("result").Value;

            Assert.Equal("ok", status);
            Assert.NotEmpty(results);
            Assert.Equal(2, results.Count);
        }
Ejemplo n.º 4
0
        public void DeleteBatch_ErrorResponse()
        {
            var           repo  = new AdvertRepo(appContext);
            List <string> files = new List <string>
            {
                "307cbed4-2f11-46ce-a3a4-f1d6fc5c268b",
                "fbc85a6f-baf8-4aad-866e-79c52e017b71"
            };

            JObject result = repo.DeleteFromStorage(files);

            string  status   = result.Property("status").Value.ToString();
            JObject problems = (JObject)result.Property("problems").Value;


            Assert.Equal("ok", status);
            Assert.Equal("Missing in the project", problems.Property(files[0]).Value);
            Assert.Equal("Missing in the project", problems.Property(files[1]).Value);
        }