internal static _VCard GetObject(MfsOperations parent)
            {
                if (_theObject == null) {
                    _theObject = new _VCard (parent);
                }

                return _theObject;
            }
        protected static ulong CreateUniqueBriefcase(ref MfsOperations mfsOperations, out string briefcaseName, out string briefcaseDesc)
        {
            do {
                briefcaseName = TestUtils.GetAWord (TYPICAL_WORD_SIZE);
                briefcaseDesc = TestUtils.GetASentence (TYPICAL_SENTENCE_SIZE, TYPICAL_WORD_SIZE);
            } while (mfsOperations.Briefcase.Exists (briefcaseName));

            return mfsOperations.Briefcase.New (briefcaseName, briefcaseDesc);
        }
 private _MasterPassword(MfsOperations parent)
 {
     _parent = parent;
     _dbOperations = new MfsDBOperations (_parent._userID, _parent._userSpecificPath);
 }
            internal static _Credentials GetObject(MfsOperations parent)
            {
                if (_theObject == null) {
                    _theObject = new _Credentials (parent);
                }

                return _theObject;
            }
        public void Test_SanityCheck()
        {
            string userIDStr = GetANonExistentUserID ();

            string password = TestUtils.GetAWord (TYPICAL_WORD_SIZE);
            string passwordHash = Hasher.GetSHA1 (password);

            MfsOperations.User.New (userIDStr, passwordHash);

            MfsOperations mfsOperations = new MfsOperations (userIDStr, passwordHash);
            Assert.IsNotNull (mfsOperations);

            // Update user password; just get a hash of last password's hash:
            string newPasswordHash = Hasher.GetSHA1 (passwordHash);
            MfsOperations.User.UpdatePassword (userIDStr, newPasswordHash);

            // Try creating an object with the old password:
            try {
                new MfsOperations (userIDStr, passwordHash);
                Assert.Fail ("User was authenticated with wrong password.");
            } catch (MfsAuthenticationException) {
            }

            // Try opening with correct password:
            new MfsOperations (userIDStr, newPasswordHash);

            MfsOperations.User.Delete (userIDStr, true, true);
        }
        public void Test_SanityCheck()
        {
            string userIDStr = GetANonExistentUserID ();

            string password = TestUtils.GetAWord (TYPICAL_WORD_SIZE);
            string passwordHash = Hasher.GetSHA1 (password);

            MfsOperations.User.New (userIDStr, passwordHash);

            MfsOperations mfsOperations = new MfsOperations (userIDStr, passwordHash);

            string fName, lName;
            mfsOperations.GetUserName (out fName, out lName);

            Assert.IsEmpty (fName);
            Assert.IsEmpty (lName);

            MfsOperations.User.Delete (userIDStr, true, true);
        }
            internal static _Document GetObject(MfsOperations parent)
            {
                if (_theObject == null) {
                    _theObject = new _Document (parent);
                }

                return _theObject;
            }
        protected static List<ulong> CreateUniqueNSchemaFreeDocuments(ref MfsOperations mfsOperations, int numSchemaFreeDocuments, DateTime when)
        {
            List<ulong> schemaFreeDocumentList = new List<ulong> ();

            for (int i = 0; i < numSchemaFreeDocuments; ++i) {
                string schemaFreeDocumentName;
                schemaFreeDocumentList.Add (CreateUniqueSchemaFreeDocument (ref mfsOperations, out schemaFreeDocumentName, when));
            }

            return schemaFreeDocumentList;
        }
        protected static ulong CreateUniquePredicate(ref MfsOperations mfsOperations, out string predicate)
        {
            do {
                predicate = TestUtils.GetAWord (TYPICAL_WORD_SIZE);
            } while (mfsOperations.Relation.DoesPredicateExist (predicate));

            return mfsOperations.Relation.NewPredicate (predicate);
        }
        protected static List<ulong> CreateUniqueNCollections(ref MfsOperations mfsOperations, int numCollections)
        {
            List<ulong> collectionList = new List<ulong> ();

            for (int i = 0; i < numCollections; ++i) {
                string collectionName;
                string collectionDesc;
                collectionList.Add (CreateUniqueCollection (ref mfsOperations, out collectionName, out collectionDesc));
            }

            return collectionList;
        }
        protected static List<ulong> CreateUniqueNPredicates(ref MfsOperations mfsOperations, int numPredicates)
        {
            List<ulong> predicatesList = new List<ulong> ();

            for (int i = 0; i < numPredicates; ++i) {
                string predicate;
                predicatesList.Add (CreateUniquePredicate (ref mfsOperations, out predicate));
            }

            return predicatesList;
        }
        protected static List<ulong> CreateUniqueNBriefcases(ref MfsOperations mfsOperations, int numBriefcases)
        {
            List<ulong> briefcaseList = new List<ulong> ();

            for (int i = 0; i < numBriefcases; ++i) {
                string briefcaseName;
                string briefcaseDesc;
                briefcaseList.Add (CreateUniqueBriefcase (ref mfsOperations, out briefcaseName, out briefcaseDesc));
            }

            return briefcaseList;
        }
        protected static List<ulong> CreateUniqueNAspects(ref MfsOperations mfsOperations, int numAspects)
        {
            List<ulong> aspectList = new List<ulong> (numAspects);

            for (int i = 0; i < numAspects; ++i) {
                string aspectName;
                string aspectDesc;
                aspectList.Add (CreateUniqueAspect (ref mfsOperations, out aspectName, out aspectDesc));
            }

            return aspectList;
        }
        protected static ulong CreateUniqueCollection(ref MfsOperations mfsOperations, out string collectionName, out string collectionDesc)
        {
            do {
                collectionName = TestUtils.GetAWord (TYPICAL_WORD_SIZE);
                collectionDesc = TestUtils.GetASentence (TYPICAL_SENTENCE_SIZE, TYPICAL_WORD_SIZE);
            } while (mfsOperations.Collection.Exists (collectionName));

            return mfsOperations.Collection.New (collectionName, collectionDesc);
        }
            internal static _AspectGroup GetObject(MfsOperations parent)
            {
                if (_theObject == null) {
                    _theObject = new _AspectGroup (parent);
                }

                return _theObject;
            }
        protected static ulong CreateUniqueSchemaFreeDocument(ref MfsOperations mfsOperations, out string schemaFreeDocName, DateTime when)
        {
            do {
                schemaFreeDocName = TestUtils.GetAWord (TYPICAL_WORD_SIZE);
            } while (mfsOperations.Sfd.Exists (schemaFreeDocName));

            return mfsOperations.Sfd.New (schemaFreeDocName, when);
        }
            internal static _Bookmark GetObject(MfsOperations parent)
            {
                if (_theObject == null) {
                    _theObject = new _Bookmark (parent);
                }

                return _theObject;
            }
 protected static ulong CreateUrl(ref MfsOperations mfsOperations)
 {
     string url = TestUtils.GetAnyUrl ();
     string description = TestUtils.GetASentence (TYPICAL_SENTENCE_SIZE, TYPICAL_WORD_SIZE);
     DateTime when = DateTime.Now;
     return mfsOperations.Url.New (url, description, when);
 }
            internal static _Briefcase GetObject(MfsOperations parent)
            {
                if (_theObject == null) {
                    _theObject = new _Briefcase (parent);
                }

                return _theObject;
            }
 protected static MfsVCard CreateVCard(ref MfsOperations mfsOperations)
 {
     MfsVCard vCard = new MfsVCard ();
     return vCard;
 }
        public void Test_SanityCheck()
        {
            string userIDStr = GetANonExistentUserID ();

            string password = TestUtils.GetAWord (TYPICAL_WORD_SIZE);
            string passwordHash = Hasher.GetSHA1 (password);

            MfsOperations.User.New (userIDStr, passwordHash);

            MfsOperations mfsOperations = new MfsOperations (userIDStr, passwordHash);
            Assert.IsNotNull (mfsOperations, "MfsOperations object was shown as null even though it isn't.");

            MfsOperations.User.Delete (userIDStr, true, true);
        }
        protected static void GetNonExistingAppUrl(ref MfsOperations mfsOperations, out string appUrl, out string username)
        {
            username = TestUtils.GetAWord (TYPICAL_WORD_SIZE);

            do {
                appUrl = TestUtils.GetAnyUrl ();
            } while (mfsOperations.Credentials.Exists (appUrl, username));
        }
        public void Test_PasswordCorrect()
        {
            string userIDStr = GetANonExistentUserID ();

            string password = TestUtils.GetAWord (TYPICAL_WORD_SIZE);
            string passwordHash = Hasher.GetSHA1 (password);

            MfsOperations.User.New (userIDStr, passwordHash);

            MfsOperations mfsOperations = new MfsOperations (userIDStr, passwordHash);
            Assert.IsNotNull (mfsOperations, "MfsOperations object was not created even though password was correct.");

            MfsOperations.User.Delete (userIDStr, true, true);
        }
        protected static ulong SaveFileToMfs(ref MfsOperations mfsOps, string fileName, string fileNarration, byte[] fileData, DateTime when, bool indexFile)
        {
            MethodSaveFile method = mfsOps.File.New;
            IAsyncResult res = method.BeginInvoke (fileName, fileNarration, fileData, when, indexFile, null, null);
            // [delegate].EndInvoke (IAsyncResult) is blocking:
            ulong fileID = method.EndInvoke (res);

            return fileID;
        }
            internal static _Relation GetObject(MfsOperations parent)
            {
                if (_theObject == null) {
                    _theObject = new _Relation (parent);
                }

                return _theObject;
            }
        protected void TestFixtureSetUp()
        {
            _userID = GetANonExistentUserID ();

            string password = TestUtils.GetAWord (TYPICAL_PASSWORD_SIZE);
            string passwordHash = Hasher.GetSHA1 (password);

            MfsOperations.User.New (_userID, passwordHash);

            _mfsOperations = new MfsOperations (_userID, passwordHash);
        }
            internal static _Archive GetObject(MfsOperations parent)
            {
                if (_theObject == null) {
                    _theObject = new _Archive (parent);
                }

                return _theObject;
            }
        protected void TestFixtureTearDown()
        {
            MfsOperations.Log.DeleteUserFileLogs (_userID);
            MfsOperations.User.Delete (_userID, true, true);

            _mfsOperations.Dispose ();
            _mfsOperations = null;
        }
 private _File(MfsOperations parent)
 {
     _parent = parent;
     _dbOperations = new MfsDBOperations (_parent._userID, _parent._userSpecificPath);
 }
        protected static ulong CreateUniqueAspect(ref MfsOperations mfsOperations, out string aspectName, out string aspectDesc)
        {
            do {
                aspectName = TestUtils.GetAWord (TYPICAL_WORD_SIZE);
                aspectDesc = TestUtils.GetASentence (TYPICAL_SENTENCE_SIZE, TYPICAL_WORD_SIZE);
            } while (mfsOperations.Aspect.Exists (aspectName));

            return mfsOperations.Aspect.New (aspectName, aspectDesc);
        }