Exemple #1
0
        /// <summary>
        /// tests moving a document in and out of folders
        /// </summary>
        [Test] public void ModelTestMoveDocuments()
        {
            const string folderTitle = "That is a new & weird folder";
            const string docTitle    = "that's the doc";

            RequestSettings settings = new RequestSettings(this.ApplicationName, this.userName, this.passWord);
            // settings.PageSize = 15;
            DocumentsRequest r = new DocumentsRequest(settings);

            Document folder = new Document();

            folder.Type  = Document.DocumentType.Folder;
            folder.Title = folderTitle;

            /// first create the folder
            folder = r.CreateDocument(folder);

            Assert.IsTrue(folder.Title == folderTitle);

            // let's create a document

            Document doc = new Document();

            doc.Type  = Document.DocumentType.Document;
            doc.Title = docTitle;

            doc = r.CreateDocument(doc);

            // create the child
            r.MoveDocumentTo(folder, doc);

            // get the folder content list

            Feed <Document> children = r.GetFolderContent(folder);

            bool fFound = false;

            foreach (Document child in children.Entries)
            {
                if (child.ResourceId == doc.ResourceId)
                {
                    fFound = true;
                    break;
                }
            }
            Assert.IsTrue(fFound, "should have found the document in the folder");
        }
        /// <summary>
        /// tests moving a document in and out of folders
        /// </summary>
        [Test] public void ModelTestMoveDocuments()
        {
            const string folderTitle = "That is a new & weird folder";
            const string docTitle = "that's the doc";

            RequestSettings settings = new RequestSettings(this.ApplicationName, this.userName, this.passWord);
            // settings.PageSize = 15;
            DocumentsRequest r = new DocumentsRequest(settings);

            Document folder = new Document();
            folder.Type = Document.DocumentType.Folder;
            folder.Title = folderTitle;

            /// first create the folder
            folder = r.CreateDocument(folder);

            Assert.IsTrue(folder.Title == folderTitle);

            // let's create a document

            Document doc = new Document();
            doc.Type = Document.DocumentType.Document;
            doc.Title = docTitle;

            doc = r.CreateDocument(doc);

            // create the child
            r.MoveDocumentTo(folder, doc);

            // get the folder content list

            Feed<Document> children = r.GetFolderContent(folder);

            bool fFound = false;
            foreach (Document child in children.Entries )
            {
                if (child.DocumentId == doc.DocumentId)
                {
                    fFound = true;
                    break;
                }
            }
            Assert.IsTrue(fFound, "should have found the document in the folder");


        }