当前位置: 首页>>代码示例>>C#>>正文


C# ComplexContainersItem.Clone方法代码示例

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


在下文中一共展示了ComplexContainersItem.Clone方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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

示例2: 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

示例3: SavingVersion_InvokesEvent

        public void SavingVersion_InvokesEvent()
        {
            savingVersionEventInvoked = false;
            ComplexContainersItem item = new ComplexContainersItem();
            item.ID = 29;

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

            editManager.SavingVersion += new EventHandler<CancellableItemEventArgs>(editManager_SavingVersion);
            IItemEditor editor = SimulateEditor(item, ItemEditorVersioningMode.VersionAndSave);

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

            Assert.IsTrue(savingVersionEventInvoked, "The saving version event wasn't invoked");
        }
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:18,代码来源:WhileDealingWithVersions.cs

示例4: 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


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