本文整理匯總了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);
}
示例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);
}
示例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");
}
示例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);
}