public void ReadFromXmlWithoutHrefThrows( string attribute, AtomLink seed, IContentSerializer dummySerializer) { XNamespace atom = "http://www.w3.org/2005/Atom"; var xml = XDocument.Parse(seed.ToXmlString(dummySerializer)); xml.Root.Attribute(attribute).Remove(); using(var r = xml.CreateReader()) { var e = Assert.Throws<ArgumentException>( () => AtomLink.ReadFrom(r)); Assert.Contains(attribute, e.Message); } }
public void SutCanRoundTripToString( AtomLink expected, IContentSerializer dummySerializer) { var xml = expected.ToXmlString(dummySerializer); AtomLink actual = AtomLink.Parse(xml); Assert.Equal(expected, actual); }
public void ReadFromReturnsCorrectResult( AtomLink expected, IContentSerializer dummySerializer) { using (var sr = new StringReader(expected.ToXmlString(dummySerializer))) using (var r = XmlReader.Create(sr)) { AtomLink actual = AtomLink.ReadFrom(r); Assert.Equal(expected, actual); } }