Exemple #1
0
 public void S3DirTest_Service_RootPath()
 {
     _s3dir = new S3Dir(_s3, "Test-Folder");
     Assert.AreEqual(_s3dir.rootPath, "Test-Folder");
     Assert.AreEqual(_s3dir.UserName, "");
     Assert.AreEqual(_s3dir.IsRoot, true);
     Assert.AreEqual(_s3dir.Level, 1);
     Assert.AreEqual(_s3dir.DirStack.Count, 0);
 }
Exemple #2
0
 public void S3DirTest_Service_UserName_TypeFile()
 {
     _s3dir = new S3Dir(_s3, "NoobMaster69", S3TypeFile.Files);
     Assert.AreEqual(_s3dir.rootPath, "Users/NoobMaster69/Files");
     Assert.AreEqual(_s3dir.UserName, "NoobMaster69");
     Assert.AreEqual(_s3dir.IsRoot, true);
     Assert.AreEqual(_s3dir.Level, 3);
     Assert.AreEqual(_s3dir.DirStack.Count, 0);
 }
Exemple #3
0
        public void UpdateDirTest()
        {
            foreach (string filename in namefiles)
            {
                _s3.UploadObjectAsync(new MemoryStream(), filename).Wait();
            }

            _s3dir = new S3Dir(_s3, "");
            _s3dir.UpdateDirAsync().Wait();
            Assert.AreEqual(_s3dir.IsRoot, true);
            Assert.AreEqual(_s3dir.Level, 0);
            Assert.IsTrue(_s3dir.SubDirs.Any(o => o.Name == "TestFolder"));
            Assert.IsTrue(_s3dir.S3Objs.Any(o => o.Name == "parentfile.kek"));
        }
Exemple #4
0
        public void CreateFolderTest()
        {
            foreach (string filename in namefiles)
            {
                _s3.UploadObjectAsync(new MemoryStream(), filename).Wait();
            }
            _s3dir = new S3Dir(_s3, "");
            _s3dir.UpdateDirAsync().Wait();
            _s3dir.SubDirAsync(_s3dir.SubDirs[0]).Wait();
            _s3dir.CreateFolderAsync("NewFolder").Wait();
            _s3dir.UpdateDirAsync().Wait();

            Assert.AreEqual(_s3dir.SubDirs.Count, 1);
        }
Exemple #5
0
        public void SubDirTest()
        {
            foreach (string filename in namefiles)
            {
                _s3.UploadObjectAsync(new MemoryStream(), filename).Wait();
            }
            _s3dir = new S3Dir(_s3, "");
            _s3dir.UpdateDirAsync().Wait();
            _s3dir.SubDirAsync(_s3dir.SubDirs[0]).Wait();

            string[] dirs       = new string[] { "file_1.txt", "file_2.jpg" };
            var      isContains = dirs.All(d => _s3dir.S3Objs.Any(o => o.Name == d));

            Assert.AreEqual(isContains, true);
            Assert.AreEqual(!_s3dir.SubDirs.Any(), true);
            Assert.AreEqual(_s3dir.IsRoot, false);
            Assert.AreEqual(_s3dir.Level, 1);
            Assert.AreEqual(_s3dir.DirStack.Count, 1);
        }