Steven Smith
2008-05-15 04:20:14 UTC
I'm struggling to figure out how to test some code that relies on XmlReader
and RssFormatter. Here's the code, which is close to what I'm using in my
library:
XmlReader reader = XmlReader.Create
("http://localhost/MyWebSite/rssfeed.aspx");
Rss20FeedFormatter formatter =
new Rss20FeedFormatter();
formatter.ReadFrom(reader);
reader.Close();
Label3.Text = formatter.Feed.Title.Text;
Label5.Text = formatter.Feed.Copyright.Text;
DataList1.DataSource =
formatter.Feed.Items.Single().lin;
DataList1.DataBind();
http://www.dotnetbips.com/articles/addaf09f-9b6b-45d2-aba8-da11f23aa53e.aspx
Neither XmlReader nor Rss20FeedFormatter implements any interfaces. I'm
considering creating wrapper classes for these and having *those* implement
interfaces which I can then use with mocks but that is a lot of trouble to
go through and I'm really hoping someone will tell me there is a better way.
Thoughts?
Steve
--
Steven A Smith | ASP.NET MVP | Microsoft Regional Director
President, ASPAlliance LLC | http://aspalliance.com
ssmith-i0bCTVip/***@public.gmane.org
and RssFormatter. Here's the code, which is close to what I'm using in my
library:
XmlReader reader = XmlReader.Create
("http://localhost/MyWebSite/rssfeed.aspx");
Rss20FeedFormatter formatter =
new Rss20FeedFormatter();
formatter.ReadFrom(reader);
reader.Close();
Label3.Text = formatter.Feed.Title.Text;
Label5.Text = formatter.Feed.Copyright.Text;
DataList1.DataSource =
formatter.Feed.Items.Single().lin;
DataList1.DataBind();
http://www.dotnetbips.com/articles/addaf09f-9b6b-45d2-aba8-da11f23aa53e.aspx
Neither XmlReader nor Rss20FeedFormatter implements any interfaces. I'm
considering creating wrapper classes for these and having *those* implement
interfaces which I can then use with mocks but that is a lot of trouble to
go through and I'm really hoping someone will tell me there is a better way.
Thoughts?
Steve
--
Steven A Smith | ASP.NET MVP | Microsoft Regional Director
President, ASPAlliance LLC | http://aspalliance.com
ssmith-i0bCTVip/***@public.gmane.org