Beispiel #1
0
        public async Task ListFileVersions()
        {
            using (var b = new TestBucket())
            {
                var uploadTasksA = new[] { b.UploadFile("file2", "contentA2"), b.UploadFile("file1", "contentA1"), b.UploadFile("file0", "contentA0") };
                await Task.WhenAll(uploadTasksA);

                var uploadTasksB = new[] { b.UploadFile("file0", "contentB0"), b.UploadFile("file1", "contentB1"), b.UploadFile("file2", "contentB2") };
                await Task.WhenAll(uploadTasksA);

                // ListFileVersions returns files in batches. The batch size is set to 2 in TestBucket.
                // Do not specify a start file name or id. Should be returned in alphabetical name order and then reverse upload time order
                var r = await b.ListFileVersions(null, null);

                Assert.AreEqual(2, r.files.Count);
                Assert.AreEqual("file0", r.files[0].fileName);
                Assert.AreEqual("file0", r.files[1].fileName);

                r = await b.ListFileVersions(r.nextFileName, r.nextFileId);

                Assert.AreEqual("file1", r.files[0].fileName);
                Assert.AreEqual("file1", r.files[1].fileName);

                r = await b.ListFileVersions(r.nextFileName, r.nextFileId);

                Assert.AreEqual("file2", r.files[0].fileName);
                Assert.AreEqual("file2", r.files[1].fileName);
            }
        }
Beispiel #2
0
        public async Task HideFile()
        {
            using (var b = new TestBucket())
            {
                var u0 = await b.UploadFile("file", "content0");

                var u1 = await b.UploadFile("file", "content1");

                var v = await b.ListFileVersions();

                Assert.AreEqual(2, v.files.Count);
                Assert.AreEqual(u0.fileName, v.files[0].fileName);
                Assert.AreEqual(u1.fileName, v.files[1].fileName);

                var h = await b.HideFile(u0.fileName);

                v = await b.ListFileVersions();

                Assert.AreEqual(2, v.files.Count);
                Assert.AreEqual("hide", v.files[0].action);
                Assert.AreEqual("upload", v.files[1].action);
            }
        }