Ejemplo n.º 1
0
        public void Test_CreateUpdateDeletePrivateMessage()
        {
            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);

            PrivateMessageManager manager = new PrivateMessageManager(this.DataStore);
            PrivateMessage        record  = Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, userBasic, folder, this.Random);

            PrivateMessage recordToCompare;

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

                manager.Update(record);
                record = manager.GetPrivateMessage(record.PrivateMessageId);

                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);
        }
Ejemplo n.º 2
0
        internal static void Delete(IDataStore dataStore, PrivateMessage privateMessage)
        {
            PrivateMessageManager manager = new PrivateMessageManager(dataStore);

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

            Assert.AreEqual(DataRepositoryActionStatus.Success, report.Status);
            Assert.IsNull(manager.GetPrivateMessage(privateMessage.PrivateMessageId));

            Trace.WriteLine("Successfully deleted privateMessage " + privateMessage.Subject);
        }
Ejemplo 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));
        }
Ejemplo n.º 4
0
        internal static PrivateMessage Create(IDataStore dataStore, IApplicationSettings applicationSettings, IApplication application
                                              , IUserBasic author, Folder folder, Random random)
        {
            PrivateMessageManager manager = new PrivateMessageManager(dataStore);

            PrivateMessage privateMessage = new PrivateMessage(
                author
                , folder
                , DebugUtility.GetRandomEnum <MessageStatus>(random)
                , DebugUtility.GetRandomEnum <MessageType>(random)
                , "PrivateMessage Subject" + random.Next(1000000, 10000000)
                , "PrivateMessage Body" + random.Next(1000000, 10000000));

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

            Assert.AreEqual(DataRepositoryActionStatus.Success, report.Status);
            Assert.Greater(privateMessage.PrivateMessageId, 0);

            PrivateMessage dsPrivateMessage = manager.GetPrivateMessage(privateMessage.PrivateMessageId);

            Assert.IsNotNull(dsPrivateMessage);

            return(dsPrivateMessage);
        }