Example #1
0
 public void CreatingDocumentAtExistingPathThrows()
 {
     CmisHelper.CreateTempDocument("__existingFile", null);
     Assert.Throws <CmdletInvocationException>(delegate {
         Shell.Execute(NewCmisDocumentCmd + "__existingFile");
     });
 }
        public void GetObjectFromFolder()
        {
            CmisHelper.CreateTempFolder("__goffFolder", false);
            var folder = _cmisNav.Get("__goffFolder");

            Assert.That(folder.Name, Is.EqualTo("__goffFolder"));
        }
        public void CreateExistingFolderWithRecursiveWorks()
        {
            var cmisF  = CmisHelper.CreateTempFolder("__cefwrwFolder", false);
            var otherF = _cmisNav.CreateFolder("__cefwrwFolder", true);

            Assert.That(otherF, Is.EqualTo(cmisF));
        }
        public void GetFolder()
        {
            CmisHelper.CreateTempFolder("__gfFolder", false);
            var folder = _cmisNav.GetFolder("__gfFolder");

            Assert.That(folder.Path, Is.EqualTo("/__gfFolder"));
        }
 public void CreateExistingDocumentThrows()
 {
     CmisHelper.CreateTempDocument("__cedtDoc", null);
     Assert.Throws <CmisNameConstraintViolationException>(delegate {
         _cmisNav.CreateDocument("__cedtDoc", null);
     });
 }
Example #6
0
 public void ReadingFolderDocumentThrows()
 {
     CmisHelper.CreateTempFolder("/__testFolder");
     Assert.Throws <CmdletInvocationException>(delegate {
         Shell.Execute(ReadCmisDocumentCmd + " /__testFolder");
     });
 }
 public void CreateExistingFolderWithoutRecursiveThrows()
 {
     CmisHelper.CreateTempFolder("__cefwrtFolder", false);
     Assert.Throws <CmisNameConstraintViolationException>(delegate {
         _cmisNav.CreateFolder("__cefwrtFolder", false);
     });
 }
 public void GetFolderFromDocThrows()
 {
     CmisHelper.CreateTempDocument("__gffdtDoc", null);
     Assert.Throws <CmisObjectNotFoundException>(delegate {
         _cmisNav.GetFolder("__gffdtDoc");
     });
 }
        public void CreateRecursiveFolder()
        {
            var cmisF = _cmisNav.CreateFolder("/__crfFolder/recursive/", true);

            CmisHelper.RegisterTempObject(CmisHelper.Get("/__crfFolder"), cmisF);
            Assert.That(cmisF.Path, Is.EqualTo("/__crfFolder/recursive"));
        }
        public void CreateSingleFolder(bool recursive)
        {
            var cmisF = _cmisNav.CreateFolder("__cfsFolder/", recursive);

            CmisHelper.RegisterTempObject(cmisF);
            Assert.That(cmisF.Path, Is.EqualTo("/__cfsFolder"));
            Assert.That(cmisF.Name, Is.EqualTo("__cfsFolder"));
        }
        public void GetDocumentFromFolderThrows()
        {
            CmisHelper.CreateTempFolder("__gdffFolder", false);

            Assert.Throws <CmisObjectNotFoundException>(delegate {
                _cmisNav.GetDocument("__gdffFolder");
            });
        }
Example #12
0
        public void ReadingByPath()
        {
            CmisHelper.CreateTempDocument("/__readByPath", "Hello World!", "text/plain");
            var res = Shell.Execute(ReadCmisDocumentCmd + " /__testFolder");

            Assert.That(res.Count, Is.EqualTo(1));
            Assert.That(res.First(), Is.EqualTo("Hello World!"));
        }
        public void GetDocument()
        {
            CmisHelper.CreateTempDocument("__gdDoc", null);
            var doc = _cmisNav.GetDocument("/__gdDoc");

            Assert.That(doc.Paths, Contains.Item("/__gdDoc"));
            Assert.That(doc.Name, Is.EqualTo("__gdDoc"));
        }
        public void DeleteNonEmptyFolderWithoutRecursionThrows()
        {
            CmisHelper.CreateTempFolder("__dnefwrtFolder/subdir", true);

            var fails = _cmisNav.Delete("__dnefwrtFolder", false);

            Assert.That(fails, Is.EquivalentTo(new string[] { "/__dnefwrtFolder/" }));
        }
Example #15
0
 [TestCase("/nonexisting/")] // empty filename
 public void CreatingDocumentWithInvalidPathThrows(string path)
 {
     CmisHelper.RegisterTempObject(path);
     Assert.Throws <CmdletInvocationException>(delegate {
         Shell.Execute(NewCmisDocumentCmd + path);
     });
     Assert.That(path, CmisHelper.DoesNotExist);
 }
Example #16
0
        public void ReadingToExistingFileWithForce()
        {
            FileSystemHelper.CreateTempFile("__toBeOverwritten.txt", "foo");
            CmisHelper.CreateTempDocument("/__overwriteExistingFile", "bar!", "text/plain");

            Shell.Execute(ReadCmisDocumentCmd +
                          " /__overwriteExistingFile __toBeOverwritten.txt -Force");
            Assert.That("bar!", FileSystemHelper.IsContentOf("__toBeOverwritten.txt"));
        }
Example #17
0
        public void ReadingNonPlainTextToPipelineThrows()
        {
            CmisHelper.CreateTempDocument("/__binaryMimeType.bin", "binaryStuff!",
                                          "application/octet-stream");

            Assert.Throws <CmdletInvocationException>(delegate {
                Shell.Execute(ReadCmisDocumentCmd + " /__binaryMimeType.bin");
            });
        }
Example #18
0
        public void ReadingNonPlainTextToFile()
        {
            CmisHelper.CreateTempDocument("/__binaryMimeType.bin", "Binary Stuff!",
                                          "application/octet-stream");
            FileSystemHelper.RegisterTempFile("__destFile.bin");

            Shell.Execute(ReadCmisDocumentCmd + " /__binaryMimeType.bin __destFile.bin");
            Assert.That("Binary Stuff!", FileSystemHelper.IsContentOf("__destFile.bin"));
        }
        public void CreateExistingFolderWithoutRecursionFails()
        {
            CmisHelper.CreateTempFolder("/__existingFolder");

            Assert.Throws <CmdletInvocationException>(delegate {
                Shell.Execute(NewCmisFolderCmd + "/__existingFolder");
            });
            Assert.That("/__existingFolder", CmisHelper.Exists);
        }
Example #20
0
        public void ReadingToExistingFileThrows()
        {
            FileSystemHelper.CreateTempFile("__existingFile", "foo");
            CmisHelper.CreateTempDocument("/__readToExistingFile", "bar!", "text/plain");

            Assert.Throws <CmdletInvocationException>(delegate {
                Shell.Execute(ReadCmisDocumentCmd + " /__readToExistingFile __existingFile");
            });
        }
        public void CreateExistingFolderWithRecursionReturns()
        {
            CmisHelper.CreateTempFolder("/__existingFolder");
            var res    = Shell.Execute(NewCmisFolderCmd + "/__existingFolder -Recursive");
            var folder = res.First() as IFolder;

            Assert.That(folder, Is.Not.Null);
            Assert.That(folder.Path, Is.EqualTo("/__existingFolder"));
        }
Example #22
0
        public void ReadingNonPlainTextToPipelineWithForce()
        {
            CmisHelper.CreateTempDocument("/__binaryMimeType2.bin", "More Binary Stuff!",
                                          "application/octet-stream");

            var res = Shell.Execute(ReadCmisDocumentCmd + " /__binaryMimeType2.bin -Force");

            Assert.That(res.Count, Is.EqualTo(1));
            Assert.That(res.First(), Is.EqualTo("More Binary Stuff!"));
        }
 public void CreateRecursiveFoldersWithoutRecursionFails()
 {
     CmisHelper.RegisterTempObject("/_foo/", "/_foo/bar"); //makes sure we clean up
     Assert.Throws <CmdletInvocationException>(delegate {
         Shell.Execute(NewCmisFolderCmd + "/__foo/bar");
     });
     Assert.That("/__foo", CmisHelper.DoesNotExist);
     Assert.That("/__foo/bar", CmisHelper.DoesNotExist);
     CmisHelper.ForgetTempObjects();
 }
Example #24
0
        public void ReadingBigFileToFile()
        {
            var content = GetStringOver100Kb();

            CmisHelper.CreateTempDocument("/__bigfile.txt", content, "text/plain");
            FileSystemHelper.RegisterTempFile("__bigout.txt");

            Shell.Execute(ReadCmisDocumentCmd + " /__bigfile.txt __bigout.txt");
            Assert.That(content, FileSystemHelper.IsContentOf("__bigout.txt"));
        }
Example #25
0
        public void ReadingBigFileToPipelineThrows()
        {
            var content = GetStringOver100Kb();

            CmisHelper.CreateTempDocument("/__bigfileToPipe.txt", content, "text/plain");

            Assert.Throws <CmdletInvocationException>(delegate {
                Shell.Execute(ReadCmisDocumentCmd + " /__bigfileToPipe.txt");
            });
        }
Example #26
0
        public void ReadingByPathToFile()
        {
            CmisHelper.CreateTempDocument("/__readByPath", "Hello World!", "text/plain");
            FileSystemHelper.RegisterTempFile("fromPathToFile.html");

            var res = Shell.Execute(ReadCmisDocumentCmd + " /__readByPath fromPathToFile.html");

            Assert.That(res, Is.Empty);
            Assert.That("Hello World!", FileSystemHelper.IsContentOf("fromPathToFile.html"));
        }
        public void UpdateFolderContentThrows()
        {
            CmisHelper.CreateTempFolder("__throwOnUpdate");

            Assert.Throws <CmdletInvocationException>(delegate {
                Shell.Execute(
                    UpdateCmisObjectCmd + "__throwOnUpdate -Content 'foo' -MimeType 'text/plain'"
                    );
            });
        }
        public void DeleteEmptyFolder(bool recursive)
        {
            CmisHelper.CreateTempFolder("__defFolder", false);

            var fails = _cmisNav.Delete("__defFolder", recursive);

            Assert.That(fails, Is.Null);
            Assert.That("__defFolder", CmisHelper.DoesNotExist);
            CmisHelper.ForgetTempObjects();
        }
        public void DeleteDocumentByObject(bool recursive)
        {
            var doc = CmisHelper.CreateTempDocument("__ddDoc", null);

            var fails = _cmisNav.Delete(doc, recursive);

            Assert.That(fails, Is.Null);
            Assert.That("__ddDoc", CmisHelper.DoesNotExist);
            CmisHelper.ForgetTempObjects();
        }
Example #30
0
        public void CreatingEmptyDocument()
        {
            CmisHelper.RegisterTempObject("/__emptyDoc");
            var res = Shell.Execute(NewCmisDocumentCmd + " /__emptyDoc");
            var doc = res.First() as IDocument;

            Assert.That(doc, Is.Not.Null);
            Assert.That(doc.Paths, Contains.Item("/__emptyDoc"));
            Assert.That("/__emptyDoc", CmisHelper.Exists);
        }