本文整理汇总了C#中System.Condition.DeepCopy方法的典型用法代码示例。如果您正苦于以下问题:C# Condition.DeepCopy方法的具体用法?C# Condition.DeepCopy怎么用?C# Condition.DeepCopy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Condition
的用法示例。
在下文中一共展示了Condition.DeepCopy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestDeepCopy
public void TestDeepCopy()
{
Condition condition = new Condition(Guid.NewGuid(), "className", new TranslateableLanguageItem("name"), OperatorType.Equals, false);
condition.DataLeft = new DataElement(Guid.NewGuid(), new TranslateableLanguageItem(), new TranslateableLanguageItem("DataLeft"), DataType.String, DataItem.CreateDataItem(new TranslateableLanguageItem("name"), DataType.String, "data"), false);
condition.DataRight = new DataElement(Guid.NewGuid(), new TranslateableLanguageItem(), new TranslateableLanguageItem("DataRight"), DataType.String, DataItem.CreateDataItem(new TranslateableLanguageItem("name"), DataType.String, "data"), false);
Condition copy = condition.DeepCopy(false) as Condition;
Assert.IsNotNull(copy);
Assert.AreEqual(condition.Identifier, copy.Identifier);
Assert.AreEqual(condition.Class, copy.Class);
Assert.AreEqual(condition.Name.Value, copy.Name.Value);
Assert.AreEqual(condition.Name.Identifier, copy.Name.Identifier);
Assert.AreEqual(condition.Operator, copy.Operator);
Assert.AreEqual(condition.Parent, copy.Parent);
Assert.AreEqual(condition.ReadOnly, copy.ReadOnly);
Assert.IsNotNull(copy.DataLeft);
Assert.AreEqual(condition.DataLeft.DisplayName, copy.DataLeft.DisplayName);
Assert.AreEqual(condition.DataLeft.Identifier, copy.DataLeft.Identifier);
Assert.AreEqual(condition.DataLeft.Name, copy.DataLeft.Name);
Assert.AreEqual(condition.DataLeft.ReadOnly, copy.DataLeft.ReadOnly);
Assert.AreEqual(condition.DataLeft.Type, copy.DataLeft.Type);
DataItem conditionItem = condition.DataLeft.Data as DataItem;
DataItem copyItem = copy.DataLeft.Data as DataItem;
Assert.AreEqual(conditionItem.Name, copyItem.Name);
Assert.AreEqual(conditionItem.ReadOnly, copyItem.ReadOnly);
Assert.AreEqual(conditionItem.Value, copyItem.Value);
Assert.IsNotNull(copy.DataRight);
Assert.AreEqual(condition.DataRight.DisplayName, copy.DataRight.DisplayName);
Assert.AreEqual(condition.DataRight.Identifier, copy.DataRight.Identifier);
Assert.AreEqual(condition.DataRight.Name, copy.DataRight.Name);
Assert.AreEqual(condition.DataRight.ReadOnly, copy.DataRight.ReadOnly);
Assert.AreEqual(condition.DataRight.Type, copy.DataRight.Type);
conditionItem = condition.DataRight.Data as DataItem;
copyItem = copy.DataRight.Data as DataItem;
Assert.AreEqual(conditionItem.Name, copyItem.Name);
Assert.AreEqual(conditionItem.ReadOnly, copyItem.ReadOnly);
Assert.AreEqual(conditionItem.Value, copyItem.Value);
}