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);
        }
        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");
        }
示例#3
0
        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);
        }