• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Items.ComplexContainersItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中N2.Tests.Edit.Items.ComplexContainersItem的典型用法代码示例。如果您正苦于以下问题:C# ComplexContainersItem类的具体用法?C# ComplexContainersItem怎么用?C# ComplexContainersItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ComplexContainersItem类属于N2.Tests.Edit.Items命名空间,在下文中一共展示了ComplexContainersItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CanUpdateItem

        public void CanUpdateItem()
        {
            ComplexContainersItem item = new ComplexContainersItem();
            IDictionary<string, Control> added = AddEditors(item);

            TextBox tbp0 = added["MyProperty0"] as TextBox;
            TextBox tbp1 = added["MyProperty1"] as TextBox;
            TextBox tbp2 = added["MyProperty2"] as TextBox;
            FreeTextArea ftap3 = added["MyProperty3"] as FreeTextArea;
            CheckBox cbp4 = added["MyProperty4"] as CheckBox;

            Assert.IsEmpty(item.MyProperty0);
            Assert.IsEmpty(item.MyProperty1);
            Assert.IsEmpty(item.MyProperty2);
            Assert.IsEmpty(item.MyProperty3);
            Assert.IsFalse(item.MyProperty4);

            tbp0.Text = "one";
            tbp1.Text = "two";
            tbp2.Text = "three";
            ftap3.Text = "rock";
            cbp4.Checked = true;

			editManager.UpdateItem(definitions.GetDefinition(item.GetContentType()), item, added, CreatePrincipal("someone"));

            Assert.AreEqual("one", item.MyProperty0);
            Assert.AreEqual("two", item.MyProperty1);
            Assert.AreEqual("three", item.MyProperty2);
            Assert.AreEqual("rock", item.MyProperty3);
            Assert.IsTrue(item.MyProperty4);
        }
开发者ID:rohancragg,项目名称:n2cms,代码行数:31,代码来源:WhileEditingContentData.cs


示例2: AddEditors

 protected IDictionary<string, Control> AddEditors(ComplexContainersItem item)
 {
     Type itemType = item.GetContentType();
     Control editorContainer = new Control();
     IDictionary<string, Control> added = editManager.AddEditors(itemType, editorContainer, null);
     return added;
 }
开发者ID:spmason,项目名称:n2cms,代码行数:7,代码来源:EditManagerTests.cs


示例3: AddEditors

 protected IDictionary<string, Control> AddEditors(ComplexContainersItem item)
 {
     Type itemType = item.GetContentType();
     Control editorContainer = new Control();
     IDictionary<string, Control> added = editManager.AddEditors(definitions.GetDefinition(itemType), item, editorContainer, CreatePrincipal("someone"));
     return added;
 }
开发者ID:JohnsonYuan,项目名称:n2cms,代码行数:7,代码来源:EditManagerTests.cs


示例4: CanUpdateEditors

        public void CanUpdateEditors()
        {
            ComplexContainersItem item = new ComplexContainersItem();
            IDictionary<string, Control> added = AddEditors(item);

            TextBox tbp0 = added["MyProperty0"] as TextBox;
            TextBox tbp1 = added["MyProperty1"] as TextBox;
            TextBox tbp2 = added["MyProperty2"] as TextBox;
            FreeTextArea ftap3 = added["MyProperty3"] as FreeTextArea;
            CheckBox cbp4 = added["MyProperty4"] as CheckBox;

            Assert.IsEmpty(tbp0.Text);
            Assert.IsEmpty(tbp1.Text);
            Assert.IsEmpty(tbp2.Text);
            Assert.IsEmpty(ftap3.Text);
            Assert.IsFalse(cbp4.Checked);

            item.MyProperty0 = "one";
            item.MyProperty1 = "two";
            item.MyProperty2 = "three";
            item.MyProperty3 = "rock";
            item.MyProperty4 = true;

            editManager.UpdateEditors(item, added, null);

            Assert.AreEqual("one", tbp0.Text);
            Assert.AreEqual("two", tbp1.Text);
            Assert.AreEqual("three", tbp2.Text);
            Assert.AreEqual("rock", ftap3.Text);
            Assert.IsTrue(cbp4.Checked);
        }
开发者ID:spmason,项目名称:n2cms,代码行数:31,代码来源:WhileEditingContentData.cs


示例5: AssertItemHasValuesFromEditors

 protected static void AssertItemHasValuesFromEditors(ComplexContainersItem item)
 {
     Assert.AreEqual("one", item.MyProperty0);
     Assert.AreEqual("two", item.MyProperty1);
     Assert.AreEqual("three", item.MyProperty2);
     Assert.AreEqual("rock", item.MyProperty3);
     Assert.IsTrue(item.MyProperty4);
 }
开发者ID:spmason,项目名称:n2cms,代码行数:8,代码来源:EditManagerTests.cs


示例6: CanSaveItem

        public void CanSaveItem()
        {
            ComplexContainersItem item = new ComplexContainersItem();

            IItemEditor editor = SimulateEditor(item, ItemEditorVersioningMode.SaveOnly);
            DoTheSaving(CreatePrincipal("someone"), editor);

            AssertItemHasValuesFromEditors(item);
        }
开发者ID:joshuaanderson,项目名称:n2cms,代码行数:9,代码来源:WhileEditingContentData.cs


示例7: SetUp

		public override void SetUp()
		{
			base.SetUp();
			editUrlManager = new EditUrlManager(new EditSection());
			root = CreateOneItem<ComplexContainersItem>(0, "root", null);
			item = CreateOneItem<ComplexContainersItem>(0, "item", root);
			version = new ComplexContainersItem { Name = "version", Title = "version", VersionOf = item, VersionIndex = 2 };
			version.SetVersionKey("VERSKEY");
		}
开发者ID:jupeterson,项目名称:n2cms,代码行数:9,代码来源:EditUrlManagerTests.cs


示例8: DoesntSaveVersion_ForNewItems

        public void DoesntSaveVersion_ForNewItems()
        {
            ComplexContainersItem item = new ComplexContainersItem();
            item.ID = 0;

            Expect.On(versioner).Call(versioner.AddVersion(item)).Repeat.Never();

            IItemEditor editor = SimulateEditor(item, ItemEditorVersioningMode.VersionAndSave);
			DoTheSaving(CreatePrincipal("someone"), editor);

            AssertItemHasValuesFromEditors(item);
        }
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:12,代码来源:WhileDealingWithVersions.cs


示例9: CanSave_ItemAndVersion

        public void CanSave_ItemAndVersion()
        {
            ComplexContainersItem item = new ComplexContainersItem();
            item.ID = 28;

            Expect.On(versioner).Call(versioner.AddVersion(item)).Return(item.Clone(false));
			versioner.Expect(v => v.TrimVersionCountTo(item, 100)).IgnoreArguments().Repeat.Any();
			versioner.Expect(v => v.IsVersionable(item)).Return(true);
            mocks.Replay(versioner);

            IItemEditor editor = SimulateEditor(item, ItemEditorVersioningMode.VersionAndSave);
            DoTheSaving(CreatePrincipal("someone"), editor);

            AssertItemHasValuesFromEditors(item);
        }
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:15,代码来源:WhileDealingWithVersions.cs


示例10: DisabledVersioning_DoesntSaveVersion

        public void DisabledVersioning_DoesntSaveVersion()
        {
            editManager.EnableVersioning = false;

            ComplexContainersItem item = new ComplexContainersItem();
            item.ID = 29;

            Expect.On(versioner).Call(versioner.SaveVersion(item)).Repeat.Never();
            mocks.Replay(versioner);

            IItemEditor editor = SimulateEditor(item, ItemEditorVersioningMode.VersionAndSave);

            DoTheSaving(CreatePrincipal("someone"), editor);

            mocks.VerifyAll();
        }
开发者ID:AnonymousRetard,项目名称:n2cms,代码行数:16,代码来源:WhileDealingWithVersions.cs


示例11: CanUpdateEditors

		public void CanUpdateEditors()
		{
			var item = new ComplexContainersItem();
			var added = AddEditors(item);

			var tbp0 = added["MyProperty0"] as TextBox;
			var tbp1 = added["MyProperty1"] as TextBox;
			var tbp2 = added["MyProperty2"] as TextBox;
			var ftap3 = added["MyProperty3"] as FreeTextArea;
			var cbp4 = added["MyProperty4"] as CheckBox;

			Assert.That(tbp0 != null);
			Assert.That(tbp1 != null);
			Assert.That(tbp2 != null);
			Assert.That(ftap3 != null);
			Assert.That(cbp4 != null);

			Assert.IsEmpty(tbp0.Text);
			Assert.IsEmpty(tbp1.Text);
			Assert.IsEmpty(tbp2.Text);
			Assert.IsEmpty(ftap3.Text);
			Assert.IsFalse(cbp4.Checked);

			item.MyProperty0 = "one";
			item.MyProperty1 = "two";
			item.MyProperty2 = "three";
			item.MyProperty3 = "rock";
			item.MyProperty4 = true;

			editManager.UpdateEditors(definitions.GetDefinition(item.GetContentType()), item, added, CreatePrincipal("someone"));

			Assert.AreEqual("one", tbp0.Text);
			Assert.AreEqual("two", tbp1.Text);
			Assert.AreEqual("three", tbp2.Text);
			Assert.AreEqual("rock", ftap3.Text);
			Assert.IsTrue(cbp4.Checked);
		}
开发者ID:meixger,项目名称:n2cms,代码行数:37,代码来源:WhileEditingContentData.cs


示例12: CanSave_VersionOnly

        public void CanSave_VersionOnly()
        {
            ComplexContainersItem item = new ComplexContainersItem();
            item.ID = 28;
            ComplexContainersItem version = item.Clone(false) as ComplexContainersItem;

			Expect.On(versioner).Call(versioner.AddVersion(item)).Return(version);
			versioner.Expect(v => v.TrimVersionCountTo(item, 100)).IgnoreArguments().Repeat.Any();
			versioner.Expect(v => v.IsVersionable(item)).Return(true);
			mocks.Replay(versioner);

            IItemEditor editor = SimulateEditor(item, ItemEditorVersioningMode.VersionOnly);
			DoTheSaving(CreatePrincipal("someone"), editor);

			Assert.That(persister.Repository.Get(28), Is.Null);

            Assert.AreEqual("", item.MyProperty0);
            Assert.AreEqual("", item.MyProperty1);
            Assert.AreEqual("", item.MyProperty2);
            Assert.AreEqual("", item.MyProperty3);
            Assert.IsFalse(item.MyProperty4);

            AssertItemHasValuesFromEditors(version);
        }
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:24,代码来源:WhileDealingWithVersions.cs


示例13: UpdateItemWithChangesReturnsTrue

		public void UpdateItemWithChangesReturnsTrue()
		{
			var item = new ComplexContainersItem();
			var added = AddEditors(item);

			var tbp0 = added["MyProperty0"] as TextBox;
			var tbp1 = added["MyProperty1"] as TextBox;
			var tbp2 = added["MyProperty2"] as TextBox;
			var ftap3 = added["MyProperty3"] as FreeTextArea;
			var cbp4 = added["MyProperty4"] as CheckBox;

			Assert.That(tbp0 != null, "tbp0 != null");
			Assert.That(tbp1 != null, "tbp1 != null");
			Assert.That(tbp2 != null, "tbp2 != null");
			Assert.That(ftap3 != null, "ftap3 != null");
			Assert.That(cbp4 != null, "cbp4 != null");
			tbp0.Text = "one";
			tbp1.Text = "two";
			tbp2.Text = "three";
			ftap3.Text = "rock";
			cbp4.Checked = true;

			var result = editManager.UpdateItem(definitions.GetDefinition(item.GetContentType()), item, added, CreatePrincipal("someone"));

			Assert.That(result.Length, Is.GreaterThan(0), "UpdateItem didn't return true even though the editors were changed.");
		}
开发者ID:meixger,项目名称:n2cms,代码行数:26,代码来源:WhileEditingContentData.cs


示例14: SaveVersionAsMaster_IsMadeMasterVersion

        public void SaveVersionAsMaster_IsMadeMasterVersion()
        {
            ComplexContainersItem currentMaster = new ComplexContainersItem(1, "current master");

            ComplexContainersItem versionToBeMaster = new ComplexContainersItem(29, "version of current");
            versionToBeMaster.VersionOf = currentMaster;

			Expect.Call(versioner.AddVersion(currentMaster)).Return(null);
			versioner.Expect(v => v.TrimVersionCountTo(null, 100)).IgnoreArguments().Repeat.Any();
			versioner.Expect(v => v.IsVersionable(versionToBeMaster)).Return(true);

            mocks.ReplayAll();

            IItemEditor editor = SimulateEditor(versionToBeMaster, ItemEditorVersioningMode.SaveAsMaster);
			DoTheSaving(CreatePrincipal("someone"), editor);

			Assert.That(persister.Repository.Get(1), Is.EqualTo(currentMaster));
        }
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:18,代码来源:WhileDealingWithVersions.cs


示例15: Using_PrivilegedUser_AddsAllEditors

        public void Using_PrivilegedUser_AddsAllEditors()
        {
            ComplexContainersItem item = new ComplexContainersItem();

            IPrincipal user = CreatePrincipal("Joe", "ÜberEditor");

            Control editorContainer = new Control();
            IDictionary<string, Control> added = editManager.AddEditors(definitions.GetDefinition(typeof(ComplexContainersItem)), item, editorContainer, user);
            Assert.AreEqual(7, added.Count);
        }
开发者ID:joshuaanderson,项目名称:n2cms,代码行数:10,代码来源:WhileEditingContentData.cs


示例16: UsingPrivilegedUserAddsAllEditors

		public void UsingPrivilegedUserAddsAllEditors()
		{
			var item = new ComplexContainersItem();
			var user = CreatePrincipal("Joe", "ÜberEditor");
			var editorContainer = new Control();
			var added = editManager.AddEditors(definitions.GetDefinition(typeof(ComplexContainersItem)), item, editorContainer, user);
			Assert.AreEqual(7, added.Count);
		}
开发者ID:meixger,项目名称:n2cms,代码行数:8,代码来源:WhileEditingContentData.cs


示例17: UpdateItem_WithNoChanges_ReturnsFalse

        public void UpdateItem_WithNoChanges_ReturnsFalse()
        {
            ComplexContainersItem item = new ComplexContainersItem();
            Type itemType = item.GetContentType();
            Control editorContainer = new Control();
            IDictionary<string, Control> added = editManager.AddEditors(definitions.GetDefinition(itemType), item, editorContainer, CreatePrincipal("someone"));

            item.MyProperty0 = "one";
            item.MyProperty1 = "two";
            item.MyProperty2 = "three";
            item.MyProperty3 = "rock";
            item.MyProperty4 = true;
            editManager.UpdateEditors(definitions.GetDefinition(item.GetContentType()), item, added, CreatePrincipal("someone"));

            var result = editManager.UpdateItem(definitions.GetDefinition(item.GetContentType()), item, added, null);

            Assert.IsFalse(result.Length > 0, "UpdateItem didn't return false even though the editors were unchanged.");
        }
开发者ID:joshuaanderson,项目名称:n2cms,代码行数:18,代码来源:WhileEditingContentData.cs


示例18: UpdateItem_WithNoChanges_IsNotSaved

        public void UpdateItem_WithNoChanges_IsNotSaved()
        {
            ComplexContainersItem item = new ComplexContainersItem();
            item.ID = 22;
            item.MyProperty0 = "one";
            item.MyProperty1 = "two";
            item.MyProperty2 = "three";
            item.MyProperty3 = "rock";
            item.MyProperty4 = true;

            Expect.On(versioner).Call(versioner.SaveVersion(item)).Return(item.Clone(false));
            versioner.Expect(v => v.TrimVersionCountTo(item, 100)).IgnoreArguments().Repeat.Any();
            versioner.Expect(v => v.IsVersionable(item)).Return(true);
            mocks.Replay(versioner);

            IItemEditor editor = SimulateEditor(item, ItemEditorVersioningMode.VersionAndSave);

            DoTheSaving(CreatePrincipal("someone"), editor);

            Assert.That(persister.Repository.Get(22), Is.Null);
        }
开发者ID:joshuaanderson,项目名称:n2cms,代码行数:21,代码来源:WhileEditingContentData.cs


示例19: UpdateItem_WithChanges_ReturnsTrue

        public void UpdateItem_WithChanges_ReturnsTrue()
        {
            ComplexContainersItem item = new ComplexContainersItem();
            IDictionary<string, Control> added = AddEditors(item);

            TextBox tbp0 = added["MyProperty0"] as TextBox;
            TextBox tbp1 = added["MyProperty1"] as TextBox;
            TextBox tbp2 = added["MyProperty2"] as TextBox;
            FreeTextArea ftap3 = added["MyProperty3"] as FreeTextArea;
            CheckBox cbp4 = added["MyProperty4"] as CheckBox;

            tbp0.Text = "one";
            tbp1.Text = "two";
            tbp2.Text = "three";
            ftap3.Text = "rock";
            cbp4.Checked = true;

            var result = editManager.UpdateItem(item, added, null);

            Assert.IsTrue(result.Length > 0, "UpdateItem didn't return true even though the editors were changed.");
        }
开发者ID:spmason,项目名称:n2cms,代码行数:21,代码来源:WhileEditingContentData.cs


示例20: Save_WhenUnpublished_PublishesItem

        public void Save_WhenUnpublished_PublishesItem()
        {
            ComplexContainersItem newItem = new ComplexContainersItem(1, "an item");
            newItem.Published = null;

			Expect.Call(versioner.AddVersion(newItem)).Return(new ComplexContainersItem(2, "ignored"));
			versioner.Expect(v => v.TrimVersionCountTo(null, 100)).IgnoreArguments().Repeat.Any();
			versioner.Expect(v => v.IsVersionable(newItem)).Return(true);
			mocks.ReplayAll();

            IItemEditor editor = SimulateEditor(newItem, ItemEditorVersioningMode.VersionAndSave);
			DoTheSaving(CreatePrincipal("someone"), editor);

			Assert.That(persister.Repository.Get(1), Is.EqualTo(newItem));
            Assert.IsNotNull(newItem.Published, "Unpublished item should have been published.");
            Assert.Greater(newItem.Published, N2.Utility.CurrentTime().AddSeconds(-10));
        }
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:17,代码来源:WhileDealingWithVersions.cs



注:本文中的N2.Tests.Edit.Items.ComplexContainersItem类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Web.PathData类代码示例发布时间:2022-05-26
下一篇:
C# Serialization.ReadingJournal类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap