System.Xml.Linq.XElement.Clone()

Here are the examples of the csharp api class System.Xml.Linq.XElement.Clone() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Example 7

1. Example

Project: libpalaso
Source File: XElementExtensionTests.cs
[TestCase("<stuff />", "stuff")]
		[TestCase("<stuff attr='myAttrValue' />", "myAttrValue")]
		[TestCase("<stuff attr='myAttrValue' ><child attr='myChildAttrValue' /></stuff>", "myChildAttrValue")]
		[TestCase("<stuff attr='myAttrValue' ><!-- Some comment --><child attr='myChildAttrValue' /></stuff>", "<!-- Some comment -->")]
		public void CloneIsSameAsSource(string sourceData, string testData)
		{
			StringAssert.Contains(testData, sourceData);
			var sourceElement = XElement.Parse(sourceData);
			var clone = sourceElement.Clone();
			Assert.AreNotSame(sourceElement, clone);
			Assert.AreEqual(sourceElement.ToString(), clone.ToString());
		}