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