public void Should_strip_multiple_object_references_from_document() { const string tmpl1 = "<tmpl0 Parent='{x:Reference __ReferenceID1}'><Reference>__ReferenceID1</Reference></tmpl0>"; var doc1 = XDocument.Parse(tmpl1); var proc = new XamlPostProcessor(); var ran = proc.ForAllElements(doc1.Descendants(), e => proc.StripObjectReferences(e)); Assert.IsTrue(ran); var root = doc1.Document.Root; Assert.IsFalse(root.HasAttributes); Assert.IsTrue(root.IsEmpty); }