Beispiel #1
0
        public void Test_SanityCheck()
        {
            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            DateTime when = DateTime.Now;
            MfsNote note = new MfsNote (noteContent, when);
            ulong noteID = _mfsOperations.Note.New (note);

            bool deleted = _mfsOperations.Document.Delete (noteID);
            Assert.IsTrue (deleted, "Document not deleted though it should have been.");
        }
Beispiel #2
0
        public void Test_CurrentDateTime_SanityCheck()
        {
            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            DateTime when = DateTime.Now;
            MfsNote note = new MfsNote (noteContent, when);

            ulong noteID = _mfsOperations.Note.New (note);
            Assert.That (noteID > 0, "Note not added successfully: Invalid note id returned.");

            _mfsOperations.Note.Delete (noteID);
        }
        public void Test_SameDoc_SameID()
        {
            // Create any document:
            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            DateTime when = DateTime.Now;
            MfsNote note = new MfsNote (noteContent, when);
            ulong noteID = _mfsOperations.Note.New (note);

            string noteUUID1 = _mfsOperations.Document.UUID (noteID);
            string noteUUID2 = _mfsOperations.Document.UUID (noteID);
            Assert.AreEqual (noteUUID1, noteUUID2, "UUID returned for same document differs.");

            _mfsOperations.Note.Delete (noteID);
        }
        public void Test_SanityCheck()
        {
            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            DateTime when = DateTime.Now;
            MfsNote note = new MfsNote (noteContent, when);
            ulong noteID = _mfsOperations.Note.New (note);

            ulong briefcaseID = _mfsOperations.Briefcase.New (_briefcaseName, _briefcaseDesc);

            bool fileMoved = _mfsOperations.Briefcase.MoveTo (noteID, briefcaseID);
            Assert.IsTrue (fileMoved, "Document was not moved successfully to briefcase.");

            ulong retrievedBriefcaseID = _mfsOperations.Briefcase.GetContaining (noteID);
            Assert.AreEqual (briefcaseID, retrievedBriefcaseID, "Document's retrieved briefcase is not the same as the one moved to.");

            _mfsOperations.Note.Delete (noteID);
            _mfsOperations.Briefcase.Delete (briefcaseID);
        }
Beispiel #5
0
        public void Test_SanityCheck_Exists()
        {
            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            DateTime when = DateTime.Now;
            MfsNote note = new MfsNote (noteContent, when);

            ulong noteID = _mfsOperations.Note.New (note);

            bool noteExists = _mfsOperations.Note.Exists (noteID);
            Assert.IsTrue (noteExists, "Note was shown as not existing, even though it does.");

            _mfsOperations.Note.Delete (noteID);
        }
Beispiel #6
0
        public void Test_SanityCheck()
        {
            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            DateTime when = DateTime.Now.AddYears (-1);
            MfsNote note = new MfsNote (noteContent, when);

            ulong noteID = _mfsOperations.Note.New (note);

            int numNotesDeleted = _mfsOperations.Note.Delete (noteID);
            Assert.AreEqual (1, numNotesDeleted, "Note was not deleted.");
        }
        public void Test_SanityCheck()
        {
            DateTime when = DateTime.Now;

            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            MfsNote note = new MfsNote (noteContent, when);
            ulong noteID = _mfsOperations.Note.New (note);

            string url = TestUtils.GetAnyUrl ();
            string description = TestUtils.GetASentence (TYPICAL_SENTENCE_SIZE, TYPICAL_WORD_SIZE);
            ulong urlID = _mfsOperations.Url.New (url, description, when);

            List<ulong> predicates = new List<ulong> ();
            char ch = 'a';
            for (int i = 0; i < TYPICAL_MULTI_VALUE; ++i) {
                string predicate = _predicate + ch++;
                ulong predicateID = _mfsOperations.Relation.NewPredicate (predicate);
                _mfsOperations.Relation.New (noteID, urlID, predicateID);
                predicates.Add (predicateID);
            }

            List<ulong> relationsList = _mfsOperations.Relation.Get (noteID, urlID);
            Assert.AreEqual (predicates.Count, relationsList.Count, "Shows incorrect number of relations.");

            predicates.Sort ();
            relationsList.Sort ();
            Assert.AreEqual (predicates, relationsList, "Wrong relations returned.");

            _mfsOperations.Document.Delete (noteID);
            _mfsOperations.Document.Delete (urlID);
            foreach (ulong predicateID in predicates) {
                _mfsOperations.Relation.DeletePredicate (predicateID);
            }
        }
        public void Test_NonExistentObjectDocID_Illegal()
        {
            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            DateTime when = DateTime.Now;
            MfsNote note = new MfsNote (noteContent, when);
            ulong noteID = _mfsOperations.Note.New (note);

            ulong veryLargeDocID = UInt64.MaxValue;

            ulong predicateID = _mfsOperations.Relation.NewPredicate (_predicate);

            try {
                _mfsOperations.Relation.SpecificExists (noteID, veryLargeDocID, predicateID);
            } finally {
                _mfsOperations.Document.Delete (noteID);
                _mfsOperations.Relation.DeletePredicate (predicateID);
            }
        }
        public void Test_SanityCheck_NotExists()
        {
            DateTime when = DateTime.Now;

            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            MfsNote note = new MfsNote (noteContent, when);
            ulong noteID = _mfsOperations.Note.New (note);

            string url = TestUtils.GetAnyUrl ();
            string description = TestUtils.GetASentence (TYPICAL_SENTENCE_SIZE, TYPICAL_WORD_SIZE);
            ulong urlID = _mfsOperations.Url.New (url, description, when);

            ulong predicateID = _mfsOperations.Relation.NewPredicate (_predicate);

            bool doesRelationExist = _mfsOperations.Relation.SpecificExists (noteID, urlID, predicateID);
            Assert.IsFalse (doesRelationExist, "Shows relation as existing even though it doesn't.");

            _mfsOperations.Document.Delete (noteID);
            _mfsOperations.Document.Delete (urlID);
            _mfsOperations.Relation.DeletePredicate (predicateID);
        }
Beispiel #10
0
        public void Test_SanityCheck()
        {
            int numDocumentsToCreate = TYPICAL_MULTI_VALUE;
            List<ulong> documentIDs = new List<ulong> (numDocumentsToCreate);
            List<ulong> bookmarkedDocumentIDs = new List<ulong> ();

            for (int i = 0; i < numDocumentsToCreate; ++i) {
                string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
                DateTime when = DateTime.Now;
                MfsNote note = new MfsNote (noteContent, when);
                ulong noteID = _mfsOperations.Note.New (note);
                documentIDs.Add (noteID);

                if (noteID % 2 == 0) {
                    _mfsOperations.Bookmark.New (noteID);
                    bookmarkedDocumentIDs.Add (noteID);
                }
            }

            List<ulong> allBookmarkedDocIDs = _mfsOperations.Bookmark.All ();

            Assert.AreEqual (bookmarkedDocumentIDs, allBookmarkedDocIDs, "Expected bookmarked documents not returned.");

            foreach (ulong noteID in documentIDs) {
                _mfsOperations.Note.Delete (noteID);
            }
        }
        public void Test_SanityCheck()
        {
            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            DateTime when = DateTime.Now;
            MfsNote note = new MfsNote (noteContent, when);
            ulong noteID = _mfsOperations.Note.New (note);

            ulong briefcaseID1 = _mfsOperations.Briefcase.New (_briefcaseName, _briefcaseDesc);

            _mfsOperations.Briefcase.MoveTo (noteID, briefcaseID1);

            ulong retrievedBriefcaseID1 = _mfsOperations.Briefcase.GetContaining (noteID);
            Assert.AreEqual (briefcaseID1, retrievedBriefcaseID1, "Document's retrieved briefcase is not the same as the one moved to.");

            string briefcaseName2 = TestUtils.GetAWord (TYPICAL_WORD_SIZE);
            ulong briefcaseID2 = _mfsOperations.Briefcase.New (briefcaseName2, _briefcaseDesc);

            _mfsOperations.Briefcase.MoveTo (noteID, briefcaseID2);

            ulong retrievedBriefcaseID2 = _mfsOperations.Briefcase.GetContaining (noteID);
            Assert.AreEqual (briefcaseID2, retrievedBriefcaseID2, "Document's retrieved briefcase is not the same as the one moved to.");

            _mfsOperations.Note.Delete (noteID);
            _mfsOperations.Briefcase.Delete (briefcaseID1);
            _mfsOperations.Briefcase.Delete (briefcaseID2);
        }
        public void Test_SanityCheck()
        {
            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            DateTime when = DateTime.Now;
            MfsNote note = new MfsNote (noteContent, when);
            ulong noteID = _mfsOperations.Note.New (note);

            ulong collectionID = _mfsOperations.Collection.New (_collectionName, _collectionDesc);

            _mfsOperations.Collection.AddDocument (noteID, collectionID);

            bool isRemoved = _mfsOperations.Collection.RemoveFrom (noteID, collectionID);
            Assert.IsTrue (isRemoved, "Document was not successfully removed from collection.");

            bool isInCollection = _mfsOperations.Collection.IsDocumentIn (noteID, collectionID);
            Assert.IsFalse (isInCollection, "Attempt to remove document from collection was not successful.");

            _mfsOperations.Collection.Delete (collectionID);
            _mfsOperations.Note.Delete (noteID);
        }
Beispiel #13
0
        public void Test_SanityCheck()
        {
            int numDocsToCreate = TYPICAL_MULTI_VALUE;
            List<ulong> docIDs = new List<ulong> (numDocsToCreate);

            for (int i = 0; i < numDocsToCreate; ++i) {
                string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
                DateTime when = DateTime.Now;
                MfsNote note = new MfsNote (noteContent, when);
                ulong noteID = _mfsOperations.Note.New (note);
                docIDs.Add (noteID);

                _mfsOperations.Bookmark.New (noteID);
            }

            List<ulong> allBookmarkedDocIDs = _mfsOperations.Bookmark.All ();
            Assert.AreEqual (docIDs.Count, allBookmarkedDocIDs.Count, "Bookmarked document list contains incorrect number of entries.");

            _mfsOperations.Bookmark.DeleteAll ();

            allBookmarkedDocIDs = _mfsOperations.Bookmark.All ();
            Assert.AreEqual (0, allBookmarkedDocIDs.Count, "Bookmarked document list contains entries after deletion of all document bookmarks.");

            foreach (ulong noteID in docIDs) {
                _mfsOperations.Note.Delete (noteID);
            }
        }
        public void Test_SanityCheck()
        {
            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            DateTime when = DateTime.Now;
            MfsNote note = new MfsNote (noteContent, when);
            ulong noteID = _mfsOperations.Note.New (note);

            int numCollectionsToCreate = TYPICAL_MULTI_VALUE;
            List<ulong> collectionIDs = CreateUniqueNCollections (ref _mfsOperations, numCollectionsToCreate);

            _mfsOperations.Collection.AddToMultiple (noteID, collectionIDs);

            int numCollectionsRemovedFrom = _mfsOperations.Collection.RemoveDocumentFromAll (noteID);
            Assert.AreEqual (numCollectionsToCreate, numCollectionsRemovedFrom, "Attempt to remove document from all collections was unsuccessful.");

            List<ulong> allCollections = _mfsOperations.Collection.CollectionsWith (noteID);
            Assert.AreEqual (0, allCollections.Count, "Incorrect number of collections from which document was removed.");

            _mfsOperations.Note.Delete (noteID);

            foreach (ulong collectionID in collectionIDs) {
                _mfsOperations.Collection.Delete (collectionID);
            }
        }
        public void Test_SanityCheck_InCollection()
        {
            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            DateTime when = DateTime.Now;
            MfsNote note = new MfsNote (noteContent, when);
            ulong noteID = _mfsOperations.Note.New (note);

            ulong collectionID = _mfsOperations.Collection.New (_collectionName, _collectionDesc);

            _mfsOperations.Collection.AddDocument (noteID, collectionID);

            bool isAdded = _mfsOperations.Collection.IsDocumentIn (noteID, collectionID);
            Assert.IsTrue (isAdded, "Indicated that document is not in collection, even though it is.");

            _mfsOperations.Collection.Delete (collectionID);
            _mfsOperations.Note.Delete (noteID);
        }
        public void Test_EmptyCollectionList_Illegal()
        {
            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            DateTime when = DateTime.Now;
            MfsNote note = new MfsNote (noteContent, when);
            ulong noteID = _mfsOperations.Note.New (note);

            try {
                _mfsOperations.Collection.AddToMultiple (noteID, new List<ulong> ());
            } finally {
                _mfsOperations.Note.Delete (noteID);
            }
        }
Beispiel #17
0
        public void Test_SanityCheck()
        {
            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            DateTime when = DateTime.Now;

            MfsNote note = new MfsNote (noteContent, when);
            ulong noteID = _mfsOperations.Note.New (note);

            MfsNote retrNote = _mfsOperations.Note.Get (noteID);

            Assert.AreEqual (note.NoteContent, retrNote.NoteContent, "Note content not as expected.");

            Assert.AreEqual (note.NoteDateTime.Year, retrNote.NoteDateTime.Year, "Note date-time year not as expected.");
            Assert.AreEqual (note.NoteDateTime.Month, retrNote.NoteDateTime.Month, "Note date-time month not as expected.");
            Assert.AreEqual (note.NoteDateTime.Day, retrNote.NoteDateTime.Day, "Note date-time day not as expected.");

            Assert.AreEqual (note.NoteDateTime.Hour, retrNote.NoteDateTime.Hour, "Note date-time hour not as expected.");
            Assert.AreEqual (note.NoteDateTime.Minute, retrNote.NoteDateTime.Minute, "Note date-time minute not as expected.");
            Assert.AreEqual (note.NoteDateTime.Second, retrNote.NoteDateTime.Second, "Note date-time second not as expected.");

            _mfsOperations.Note.Delete (noteID);
        }
            public ulong New(MfsNote note)
            {
                if (note == null) {
                    throw new MfsIllegalArgumentException (
                        MfsErrorMessages.GetMessage (MessageType.NULL, "Note object")
                    );
                }

                return _dbOperations.AddNote (note);
            }
Beispiel #19
0
        public void Test_SanityCheck()
        {
            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            DateTime when = DateTime.Now;
            MfsNote note = new MfsNote (noteContent, when);

            ulong noteID = _mfsOperations.Note.New (note);

            DateTime savedDate = _mfsOperations.Note.GetDateTime (noteID);
            Assert.AreEqual (when.Year, savedDate.Year, "Year returned is not the same as saved year.");
            Assert.AreEqual (when.Month, savedDate.Month, "Month returned is not the same as saved month.");
            Assert.AreEqual (when.Day, savedDate.Day, "Day returned is not the same as saved day.");
            Assert.AreEqual (when.Hour, savedDate.Hour, "Hour returned is not the same as saved hour.");
            Assert.AreEqual (when.Minute, savedDate.Minute, "Minute returned is not the same as saved minute.");
            Assert.AreEqual (when.Second, savedDate.Second, "Second returned is not the same as saved second.");

            _mfsOperations.Note.Delete (noteID);
        }
Beispiel #20
0
        public void Test_SanityCheck()
        {
            DateTime when = DateTime.Now;

            // First save a file:
            _fileData = TestUtils.GetAnyFileData (FileSize.SMALL_FILE_SIZE);
            ulong fileID = SaveFileToMfs (ref _mfsOperations, _fileName, _fileNarration, _fileData, when, false);
            Assert.That (fileID > 0, "File id returned is not a valid value.");

            // Next, save a note:
            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            MfsNote note = new MfsNote (noteContent, when);
            ulong noteID = _mfsOperations.Note.New (note);
            Assert.That (noteID > 0, "Note id returned is not a valid value.");

            // And also save a url:
            string url = TestUtils.GetAnyUrl ();
            string description = TestUtils.GetASentence (TYPICAL_SENTENCE_SIZE, TYPICAL_WORD_SIZE);
            ulong urlID = _mfsOperations.Url.New (url, description, when);
            Assert.That (urlID > 0, "Url id returned is not a valid value.");

            DocumentType docType1 = _mfsOperations.Document.Type (fileID);
            Assert.That (docType1 == DocumentType.FILE, "Indicated that document type is not a file even though it is.");

            DocumentType docType2 = _mfsOperations.Document.Type (noteID);
            Assert.That (docType2 == DocumentType.NOTE, "Indicated that document type is not a note even though it is.");

            DocumentType docType3 = _mfsOperations.Document.Type (urlID);
            Assert.That (docType3 == DocumentType.URL, "Indicated that document type is not a url even though it is.");

            _mfsOperations.File.Delete (fileID);
            _mfsOperations.Note.Delete (noteID);
            _mfsOperations.Url.Delete (urlID);
        }
        public void Test_NonExistentPredicateID_Illegal()
        {
            DateTime when = DateTime.Now;

            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            MfsNote note = new MfsNote (noteContent, when);
            ulong noteID = _mfsOperations.Note.New (note);

            string url = TestUtils.GetAnyUrl ();
            string description = TestUtils.GetASentence (TYPICAL_SENTENCE_SIZE, TYPICAL_WORD_SIZE);
            ulong urlID = _mfsOperations.Url.New (url, description, when);

            ulong veryLargePredicateID = UInt64.MaxValue;

            try {
                _mfsOperations.Relation.New (noteID, urlID, veryLargePredicateID);
            } finally {
                _mfsOperations.Document.Delete (noteID);
                _mfsOperations.Document.Delete (urlID);
            }
        }
Beispiel #22
0
        public void Test_SanityCheck()
        {
            DateTime when = DateTime.Now;

            // First save a file:
            _fileData = TestUtils.GetAnyFileData (FileSize.SMALL_FILE_SIZE);
            ulong fileID = SaveFileToMfs (ref _mfsOperations, _fileName, _fileNarration, _fileData, when, false);
            Assert.That (fileID > 0, "File id returned is not a valid value.");

            // Next, save a note:
            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            MfsNote note = new MfsNote (noteContent, when);
            ulong noteID = _mfsOperations.Note.New (note);
            Assert.That (noteID > 0, "Note id returned is not a valid value.");

            // And also save a url:
            string url = TestUtils.GetAnyUrl ();
            string description = TestUtils.GetASentence (TYPICAL_SENTENCE_SIZE, TYPICAL_WORD_SIZE);
            ulong urlID = _mfsOperations.Url.New (url, description, when);
            Assert.That (urlID > 0, "Url id returned is not a valid value.");

            // Next, confirm that all document ids are different:
            Assert.AreNotEqual (fileID, noteID, "File id is the same as note id.");
            Assert.AreNotEqual (fileID, urlID, "File id is the same as url id.");
            Assert.AreNotEqual (noteID, urlID, "Note id is the same as url id.");

            _mfsOperations.File.Delete (fileID);
            _mfsOperations.Note.Delete (noteID);
            _mfsOperations.Url.Delete (urlID);
        }
        public void Test_PredicateIDZero_Illegal()
        {
            DateTime when = DateTime.Now;

            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            MfsNote note = new MfsNote (noteContent, when);
            ulong noteID = _mfsOperations.Note.New (note);

            string url = TestUtils.GetAnyUrl ();
            string description = TestUtils.GetASentence (TYPICAL_SENTENCE_SIZE, TYPICAL_WORD_SIZE);
            ulong urlID = _mfsOperations.Url.New (url, description, when);

            try {
                _mfsOperations.Relation.SpecificExists (noteID, urlID, 0);
            } finally {
                _mfsOperations.Document.Delete (noteID);
                _mfsOperations.Document.Delete (urlID);
            }
        }
        public void Test_ObjectDocIDZero_Illegal()
        {
            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            DateTime when = DateTime.Now;
            MfsNote note = new MfsNote (noteContent, when);
            ulong noteID = _mfsOperations.Note.New (note);

            try {
                _mfsOperations.Relation.RemoveAll (noteID, 0);
            } finally {
                _mfsOperations.Document.Delete (noteID);
            }
        }
        public void Test_SubjectDocIDZero_Illegal()
        {
            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            DateTime when = DateTime.Now;
            MfsNote note = new MfsNote (noteContent, when);
            ulong noteID = _mfsOperations.Note.New (note);

            ulong predicateID = _mfsOperations.Relation.NewPredicate (_predicate);

            try {
                _mfsOperations.Relation.SpecificExists (0, noteID, predicateID);
            } finally {
                _mfsOperations.Document.Delete (noteID);
            }
        }
 protected static ulong CreateNote(ref MfsOperations mfsOperations)
 {
     string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
     DateTime when = DateTime.Now;
     MfsNote note = new MfsNote (noteContent, when);
     return mfsOperations.Note.New (note);
 }
        public void Test_NonExistentSubjectDocID_Illegal()
        {
            ulong veryLargeDocID = UInt64.MaxValue;

            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            DateTime when = DateTime.Now;
            MfsNote note = new MfsNote (noteContent, when);
            ulong noteID = _mfsOperations.Note.New (note);

            try {
                _mfsOperations.Relation.RemoveAll (veryLargeDocID, noteID);
            } finally {
                _mfsOperations.Document.Delete (noteID);
            }
        }
        public void Test_SanityCheck()
        {
            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            DateTime when = DateTime.Now;
            MfsNote note = new MfsNote (noteContent, when);
            ulong noteID = _mfsOperations.Note.New (note);

            ulong briefcaseID = _mfsOperations.Briefcase.New (_briefcaseName, _briefcaseDesc);

            _mfsOperations.Briefcase.MoveTo (noteID, briefcaseID);

            bool removedFromBriefcase = _mfsOperations.Briefcase.MoveToGlobal (noteID);

            ulong retrievedBriefcaseID = _mfsOperations.Briefcase.GetContaining (noteID);
            Assert.AreEqual (MfsOperations.GlobalBriefcase, retrievedBriefcaseID, "Removing document from briefcase does not delete its reference.");

            _mfsOperations.Note.Delete (noteID);
            _mfsOperations.Briefcase.Delete (briefcaseID);
        }
        public void Test_SanityCheck()
        {
            DateTime when = DateTime.Now;

            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            MfsNote note = new MfsNote (noteContent, when);
            ulong noteID = _mfsOperations.Note.New (note);

            string url = TestUtils.GetAnyUrl ();
            string description = TestUtils.GetASentence (TYPICAL_SENTENCE_SIZE, TYPICAL_WORD_SIZE);
            ulong urlID = _mfsOperations.Url.New (url, description, when);

            ulong predicateID = _mfsOperations.Relation.NewPredicate (_predicate);

            bool relationCreated = _mfsOperations.Relation.New (noteID, urlID, predicateID);
            Assert.IsTrue (relationCreated, "Relation not created successfully.");

            bool relationRemoved = _mfsOperations.Relation.RemoveAll (noteID, urlID);
            Assert.IsTrue (relationRemoved, "Relation not removed successfully.");

            bool relationExists = _mfsOperations.Relation.Exists (noteID, urlID);
            Assert.IsFalse (relationExists, "Shows relation as existing even though none does.");

            _mfsOperations.Document.Delete (noteID);
            _mfsOperations.Document.Delete (urlID);
            _mfsOperations.Relation.DeletePredicate (predicateID);
        }
Beispiel #30
0
        public void Test_SanityCheck()
        {
            string noteContent = TestUtils.GetASentence (TestMfsOperationsBase.TYPICAL_SENTENCE_SIZE, TestMfsOperationsBase.TYPICAL_WORD_SIZE);
            DateTime when = DateTime.Now;

            MfsNote note = new MfsNote (noteContent, when);
            Assert.IsNotNull (note, "Note was not created successfully.");
        }