本文整理汇总了C#中Author.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# Author.Clone方法的具体用法?C# Author.Clone怎么用?C# Author.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Author
的用法示例。
在下文中一共展示了Author.Clone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: A_Clone_Should_Have_Identital_Values
public void A_Clone_Should_Have_Identital_Values()
{
var author = new Author()
{
Id = 12,
FirstName = "Bruce",
LastName = "Wayne"
};
var clone = new Author();
author.Clone(clone);
Assert.AreEqual(12, clone.Id);
Assert.AreEqual("Bruce", clone.FirstName);
Assert.AreEqual("Wayne", clone.LastName);
}
示例2: The_Original_Should_Be_Modified_Without_Changing_The_Clone
public void The_Original_Should_Be_Modified_Without_Changing_The_Clone()
{
var author = new Author()
{
Id = 12,
FirstName = "Bruce",
LastName = "Wayne"
};
var clone = new Author();
author.Clone(clone);
author.Id = 13;
author.FirstName = "Dick";
author.LastName = "Grayson";
Assert.AreEqual(12, clone.Id);
Assert.AreEqual("Bruce", clone.FirstName);
Assert.AreEqual("Wayne", clone.LastName);
}