public void ParseAndFormat(SampleFeed embeddedDocument) { // arrange var document1 = embeddedDocument.XDocument; // action var tryParseResult = Rss10FeedParser.TryParseRss10Feed(document1, out var feed); Assert.True(tryParseResult); var tryFormatResult = Rss10FeedFormatter.TryFormatRss10Feed(feed, out var document2); Assert.True(tryFormatResult); var xmlWriterSettings = new XmlWriterSettings { Indent = true }; var xmlStringBuilder1 = new StringBuilder(); var xmlStringBuilder2 = new StringBuilder(); using (var xmlWriter1 = XmlWriter.Create(xmlStringBuilder1, xmlWriterSettings)) using (var xmlWriter2 = XmlWriter.Create(xmlStringBuilder2, xmlWriterSettings)) { document1.WriteTo(xmlWriter1); document2.WriteTo(xmlWriter2); xmlWriter1.Flush(); xmlWriter2.Flush(); // assert var xmlString1 = xmlStringBuilder1.ToString(); var xmlString2 = xmlStringBuilder2.ToString(); Assert.Equal(xmlString1, xmlString2); } }
public void ParseWithoutCrashing(SampleFeed embeddedDocument) { // arrange var document = embeddedDocument.XDocument; // action // ReSharper disable once UnusedVariable var tryParseResult = Rss10FeedParser.TryParseRss10Feed(document, out var parsedFeed); // assert Assert.True(tryParseResult); }