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);
        }