public void Test_CreateUpdateDeleteThread() { ArticleGroup articleGroup = Test_ArticleGroups.Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, this.Random); ArticleGroupThreadManager manager = new ArticleGroupThreadManager(this.DataStore); ArticleGroupThread record = Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, articleGroup, this.Random); ArticleGroupThread recordToCompare; for (int i = 0; i < this.DefaultUpdateTestIterations; i++) { PopulateWithRandomValues(record, this.DummyDataManager, this.Random); recordToCompare = record; manager.Update(record); record = manager.GetArticleGroupThread(record.ArticleGroupThreadId); 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_ArticleGroups.Delete(this.DataStore, articleGroup); }
public void Test_CreateUpdateDeleteContent() { IUserBasic userBasic = Test_WorkmateMembershipProvider.CreateUser(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, this.DummyDataManager); CMSSection section = Test_CMSSections.Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, null, this.Random); CMSThread thread = Test_CMSThreads.Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, section, this.Random); CMSContentManager manager = new CMSContentManager(this.DataStore); CMSContent record = Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, userBasic.UserId, thread, this.Random); CMSContent recordToCompare; for (int i = 0; i < this.DefaultUpdateTestIterations; i++) { PopulateWithRandomValues(record, this.DummyDataManager, this.Random); recordToCompare = record; manager.Update(record); record = manager.GetContent(record.CMSContentId); 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_CMSSections.Delete(this.DataStore, section); }
public void Test_CreateUpdateDeleteThreadRating() { IUserBasic userBasic = Test_WorkmateMembershipProvider.CreateUser(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, this.DummyDataManager); CMSSection section = Test_CMSSections.Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, null, this.Random); CMSThread thread = Test_CMSThreads.Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, section, this.Random); CMSThreadRatingManager manager = new CMSThreadRatingManager(this.DataStore); CMSThreadRating record = new CMSThreadRating(userBasic, thread, 1); BusinessObjectActionReport <RatingDataRepositoryActionStatus> report = manager.Create(record); Assert.AreEqual(RatingDataRepositoryActionStatus.Success, report.Status); CMSThreadRating recordToCompare; for (int i = 0; i < this.DefaultUpdateTestIterations; i++) { PopulateWithRandomValues(record, this.DummyDataManager, this.Random); recordToCompare = record; manager.Update(record); record = manager.GetThreadRating(thread, userBasic); 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, thread, userBasic); Test_CMSSections.Delete(this.DataStore, section); // deleting the section should also delete the file }
public void Test_CreateUpdateDeleteSystemProfileImageFile() { IUserBasic userBasic = Test_WorkmateMembershipProvider.CreateUser(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, this.DummyDataManager); SystemProfileImageManager manager = new SystemProfileImageManager(this.DataStore); SystemProfileImage record = Test_SystemProfileImages.CreateSystemProfileImage(this.DataStore, this.Application.ApplicationId, this.Random); SystemProfileImage recordToCompare; for (int i = 0; i < this.DefaultUpdateTestIterations; i++) { PopulateWithRandomValues(record, this.DummyDataManager, this.Random); recordToCompare = record; manager.Update(record); record = manager.GetSystemProfileImage(record.ImageId); 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); }
public void Test_CreateUpdateDeleteGroup() { CMSGroupManager manager = new CMSGroupManager(this.DataStore); CMSGroup record = Create(this.DataStore, this.Random); CMSGroup recordToCompare; for (int i = 0; i < this.DefaultUpdateTestIterations; i++) { PopulateWithRandomValues(record, this.DummyDataManager, this.Random); recordToCompare = record; manager.Update(record); record = manager.GetGroup(record.CMSGroupId); 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); }
public void Test_CreateUpdateDeleteOffice() { OfficeManager manager = new OfficeManager(this.DataStore); IOfficeModel record = Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application , this.DummyDataManager, this.Random); IOfficeModel recordToCompare; for (int i = 0; i < this.DefaultUpdateTestIterations; i++) { PopulateWithRandomValues(record, this.DummyDataManager, this.Random); recordToCompare = record; manager.Update(record); record = manager.GetOffice(record.ApplicationId, record.OfficeId); string errors = string.Empty; Assert.IsTrue(DebugUtility.ArePropertyValuesEqual(record, recordToCompare, out errors), errors); Trace.WriteLine("Update test successfull."); } Delete(this.DataStore, record); }
public void Test_CreateUpdateDeleteArticle() { IUserBasic userBasic = Test_WorkmateMembershipProvider.CreateUser(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, this.DummyDataManager); MessageBoard messageBoard = Test_MessageBoards.Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, this.Random); ArticleGroup articleGroup = Test_ArticleGroups.Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, this.Random); ArticleGroupThread articleGroupThread = Test_ArticleGroupThreads.Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, articleGroup, this.Random); ArticleManager manager = new ArticleManager(this.DataStore); Article record = Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, userBasic , articleGroupThread, messageBoard, this.Random); MessageBoardThreadManager messageBoardThreadManager = new MessageBoardThreadManager(this.DataStore); Article recordToCompare; for (int i = 0; i < this.DefaultUpdateTestIterations; i++) { PopulateWithRandomValues(record, this.DummyDataManager, this.Random); recordToCompare = record; manager.Update(record); record = manager.GetArticle(record.ArticleId); string errors = string.Empty; // TODO (Roman): relax datetime comparisons Assert.IsTrue(DebugUtility.ArePropertyValuesEqual(record, recordToCompare, out errors), errors); Trace.WriteLine("Update test successfull."); } IArticleModel articleModel = manager.GetArticleModel(record.ArticleId); Assert.AreEqual(0, articleModel.TotalComments); #region messageboards MessageBoardThread messageBoardThread = messageBoardThreadManager.GetMessageBoardThread(articleModel.MessageBoardThreadId); Assert.IsNotNull(messageBoardThread); MessageManager messageManager = new MessageManager(this.DataStore); messageManager.Create(new Message(userBasic, messageBoardThread, "Test Message Subject 1", "Body1")); messageManager.Create(new Message(userBasic, messageBoardThread, "Test Message Subject 2", "Body2")); Message message = new Message(userBasic, messageBoardThread, "Test Message Subject 3", "Body3"); messageManager.Create(message); articleModel = manager.GetArticleModel(record.ArticleId); Assert.AreEqual(3, articleModel.TotalComments); Assert.AreEqual(DataRepositoryActionStatus.Success, messageManager.Delete(message).Status); articleModel = manager.GetArticleModel(record.ArticleId); Assert.AreEqual(2, articleModel.TotalComments); #endregion #region attachments IArticleAttachmentModel articleAttachmentModel = AddAttachment(this.DataStore, this.Application.ApplicationId, articleModel, userBasic, this.Random); AddAttachment(this.DataStore, this.Application.ApplicationId, articleModel, userBasic, this.Random); DeleteAttachment(this.DataStore, articleModel, articleAttachmentModel.AttachmentId, this.Random); AddAttachment(this.DataStore, this.Application.ApplicationId, articleModel, userBasic, this.Random); AddAttachment(this.DataStore, this.Application.ApplicationId, articleModel, userBasic, this.Random); articleAttachmentModel = AddAttachment(this.DataStore, this.Application.ApplicationId, articleModel, userBasic, this.Random); DeleteAttachment(this.DataStore, articleModel, articleAttachmentModel.AttachmentId, this.Random); AddAttachment(this.DataStore, this.Application.ApplicationId, articleModel, userBasic, this.Random); #endregion #region contentnodelevels if (articleModel.ContentLevelNodeId.HasValue) { string newName = "Some Name" + this.Random.Next(10000, 100000); CMSContentLevelNodeManager contentLevelNodeManager = new CMSContentLevelNodeManager(this.DataStore); contentLevelNodeManager.RenameContentLevelNode(articleModel.ContentLevelNodeId.Value, newName); articleModel = manager.GetArticleModel(record.ArticleId); Assert.AreEqual(articleModel.ContentLevelNodes[articleModel.ContentLevelNodes.Count - 1], newName); } #endregion Delete(this.DataStore, record); Test_ArticleGroups.Delete(this.DataStore, articleGroup); Assert.IsNull(messageBoardThreadManager.GetMessageBoardThread(articleModel.MessageBoardThreadId)); ArticleAttachmentManager articleAttachmentManager = new ArticleAttachmentManager(this.DataStore); Assert.IsEmpty(articleAttachmentManager.GetArticleAttachments(articleModel.ArticleId)); }