public void Test_CreateUpdateDeleteThread() { ContentPlaceholderGroup contentPlaceholderGroup = Test_ContentPlaceholderGroup.Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, this.Random); ContentPlaceholder contentPlaceholder = Test_ContentPlaceholders.Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, contentPlaceholderGroup, this.Random); ContentPlaceholderHistoryManager manager = new ContentPlaceholderHistoryManager(this.DataStore); ContentPlaceholderHistory record = Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, contentPlaceholder, this.Random); ContentPlaceholderHistory recordToCompare; for (int i = 0; i < this.DefaultUpdateTestIterations; i++) { PopulateWithRandomValues(record, this.DummyDataManager, this.Random); recordToCompare = record; manager.Update(record); record = manager.GetContentPlaceholderHistory(record.ContentPlaceholderHistoryId); 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_ContentPlaceholders.Delete(this.DataStore, contentPlaceholder); Test_ContentPlaceholderGroup.Delete(this.DataStore, contentPlaceholderGroup); }
internal static void Delete(IDataStore dataStore, ContentPlaceholderGroup contentPlaceholderGroup) { ContentPlaceholderGroupManager manager = new ContentPlaceholderGroupManager(dataStore); BusinessObjectActionReport <DataRepositoryActionStatus> report = manager.Delete(contentPlaceholderGroup); Assert.AreEqual(DataRepositoryActionStatus.Success, report.Status); Assert.IsNull(manager.GetContentPlaceholderGroup(contentPlaceholderGroup.ContentPlaceholderGroupId)); Trace.WriteLine("Successfully deleted contentPlaceholderGroup " + contentPlaceholderGroup.ContentPlaceholderGroupId); }
public void Test_UpdateContentBlock() { IUserBasic userBasic = Test_WorkmateMembershipProvider.CreateUser(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, this.DummyDataManager); ContentPlaceholderGroup contentPlaceholderGroup = Test_ContentPlaceholderGroup.Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, this.Random); ContentPlaceholderManager manager = new ContentPlaceholderManager(this.DataStore); ContentBlockManager contentBlockManager = new ContentBlockManager(this.DataStore); string key = "test_content_block"; int contentBlockId; Dictionary <string, string> lookup; ContentUpdateStatus contentUpdateStatus = manager.UpdateContentBlock(this.Application.ApplicationId, userBasic , key, "Body1", out contentBlockId); // TODO (Roman): Html testing... Assert.AreEqual(ContentUpdateStatus.Success, contentUpdateStatus); Assert.Greater(contentBlockId, 0); ContentBlock contentBlock1 = contentBlockManager.GetContentBlock(contentBlockId); Assert.IsNotNull(contentBlock1); Assert.AreEqual(ContentBlockStatus.Active, contentBlock1.ContentBlockStatus); Assert.AreEqual("Body1", contentBlock1.FormattedBody); lookup = manager.GetContentPlaceholderBodies(this.Application.ApplicationId); Assert.IsNotNull(lookup); Assert.IsTrue(lookup.ContainsKey(key)); Assert.AreEqual(lookup[key], "Body1"); contentUpdateStatus = manager.UpdateContentBlock(this.Application.ApplicationId, userBasic , key, "Body2", out contentBlockId); Assert.AreEqual(ContentUpdateStatus.Success, contentUpdateStatus); Assert.Greater(contentBlockId, 0); ContentBlock contentBlock2 = contentBlockManager.GetContentBlock(contentBlockId); Assert.IsNotNull(contentBlock2); Assert.AreEqual(ContentBlockStatus.Active, contentBlock2.ContentBlockStatus); Assert.AreEqual("Body2", contentBlock2.FormattedBody); contentBlock1 = contentBlockManager.GetContentBlock(contentBlock1.ContentBlockId); Assert.IsNotNull(contentBlock1); Assert.AreEqual(ContentBlockStatus.Inactive, contentBlock1.ContentBlockStatus); Assert.AreEqual("Body1", contentBlock1.FormattedBody); lookup = manager.GetContentPlaceholderBodies(this.Application.ApplicationId); Assert.IsNotNull(lookup); Assert.IsTrue(lookup.ContainsKey(key)); Assert.AreEqual(lookup[key], "Body2"); }
public void Test_CreateUpdateDeleteContentBlock() { IUserBasic userBasic = Test_WorkmateMembershipProvider.CreateUser(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, this.DummyDataManager); ContentPlaceholderGroup contentPlaceholderGroup = Test_ContentPlaceholderGroup.Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, this.Random); ContentPlaceholder contentPlaceholder = Test_ContentPlaceholders.Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, contentPlaceholderGroup, this.Random); ContentPlaceholderHistory contentPlaceholderHistory = Test_ContentPlaceholderHistorys.Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, contentPlaceholder, this.Random); ContentBlockManager manager = new ContentBlockManager(this.DataStore); ContentBlock record = Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, userBasic, contentPlaceholderHistory, this.Random); Delete(this.DataStore, record); Test_ContentPlaceholders.Delete(this.DataStore, contentPlaceholder); Test_ContentPlaceholderGroup.Delete(this.DataStore, contentPlaceholderGroup); }
internal static ContentPlaceholderGroup Create(IDataStore dataStore, IApplicationSettings applicationSettings, IApplication application, Random random) { ContentPlaceholderGroupManager manager = new ContentPlaceholderGroupManager(dataStore); ContentPlaceholderGroup contentPlaceholderGroup = new ContentPlaceholderGroup( random.Next(1000, 2000) , "TestContentPlaceholderGroup " + random.Next(1000000, 10000000)); BusinessObjectActionReport <DataRepositoryActionStatus> report = manager.Create(contentPlaceholderGroup); Assert.AreEqual(DataRepositoryActionStatus.Success, report.Status); Assert.Greater(contentPlaceholderGroup.ContentPlaceholderGroupId, 0); ContentPlaceholderGroup dsContentPlaceholderGroup = manager.GetContentPlaceholderGroup(contentPlaceholderGroup.ContentPlaceholderGroupId); Assert.IsNotNull(dsContentPlaceholderGroup); return(dsContentPlaceholderGroup); }
public BusinessObjectActionReport <DataRepositoryActionStatus> Delete(ContentPlaceholderGroup group) { return(_CMSGroupManager.Delete(group.CMSGroup)); }
internal static void PopulateWithRandomValues(ContentPlaceholderGroup record, DummyDataManager dtm, Random random) { }