Esempio n. 1
0
        public void Test_CreateUpdateDeleteThread()
        {
            Inbox inbox = Test_Inboxs.Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, this.Random);

            FolderManager manager = new FolderManager(this.DataStore);
            Folder        record  = Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, inbox, this.Random);

            Folder recordToCompare;

            for (int i = 0; i < this.DefaultUpdateTestIterations; i++)
            {
                PopulateWithRandomValues(record, this.DummyDataManager, this.Random);
                recordToCompare = record;

                manager.Update(record);
                record = manager.GetFolder(record.FolderId);

                string errors = string.Empty;
                // TODO (Roman): relax datetime comparisons
                Assert.IsTrue(DebugUtility.ArePropertyValuesEqual(record, recordToCompare, out errors), errors);
                Trace.WriteLine("Update test successfull.");
            }

            Delete(this.DataStore, record);
            Test_Inboxs.Delete(this.DataStore, inbox);
        }
Esempio n. 2
0
        internal static void Delete(IDataStore dataStore, Folder folder)
        {
            FolderManager manager = new FolderManager(dataStore);

            BusinessObjectActionReport <DataRepositoryActionStatus> report = manager.Delete(folder);

            Assert.AreEqual(DataRepositoryActionStatus.Success, report.Status);
            Assert.IsNull(manager.GetFolder(folder.FolderId));

            Trace.WriteLine("Successfully deleted folder " + folder.FolderName);
        }
Esempio n. 3
0
        public void Test_Delete_Inbox()
        {
            IUserBasic     userBasic      = Test_WorkmateMembershipProvider.CreateUser(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, this.DummyDataManager);
            Inbox          inbox          = Test_Inboxs.Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, this.Random);
            Folder         folder         = Test_Folders.Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, inbox, this.Random);
            PrivateMessage privateMessage = Test_PrivateMessages.Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, userBasic, folder, this.Random);

            Test_Inboxs.Delete(this.DataStore, inbox);

            FolderManager         folderManager         = new FolderManager(this.DataStore);
            PrivateMessageManager privateMessageManager = new PrivateMessageManager(this.DataStore);

            Assert.IsNull(folderManager.GetFolder(folder.FolderId));
            Assert.IsNull(privateMessageManager.GetPrivateMessage(privateMessage.PrivateMessageId));
        }
Esempio n. 4
0
        internal static Folder Create(IDataStore dataStore, IApplicationSettings applicationSettings, IApplication application, Inbox inbox, Random random)
        {
            FolderManager manager = new FolderManager(dataStore);

            Folder folder = new Folder(
                inbox
                , "TestThread " + random.Next(1000000, 10000000));

            BusinessObjectActionReport <DataRepositoryActionStatus> report = manager.Create(folder);

            Assert.AreEqual(DataRepositoryActionStatus.Success, report.Status);
            Assert.Greater(folder.FolderId, 0);

            Folder dsThread = manager.GetFolder(folder.FolderId);

            Assert.IsNotNull(dsThread);

            return(dsThread);
        }