public void as_xml_textreader() { Assert.Throws<ArgumentNullException>(() => XmlExtensions.AsXml<object>(null)); var subject = Guid.Empty; using (var reader = new StringReader(subject.ToXml())) { Assert.True(reader.AsXml<Guid>() == subject); reader.ReadLine(); } using (var reader = new StringReader(subject.ToXml())) { Assert.Equal(subject, reader.AsXml<Guid>(true)); Assert.Throws<ObjectDisposedException>(() => reader.ReadLine()); } }