<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" media="screen" href="/styles/xslt/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:c9="http://channel9.msdn.com">
<channel>
	<title>Comment Feed for Channel 9 - Extreme ASP.NET Makeover: Mr. Escher, Your Software is Ready - Dependency</title>
	<atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/Blogs/howarddierking/Extreme-ASPNET-Makeover-Mr-Escher-Your-Software-is-Ready-Dependency/RSS"></atom:link>
	<image>
		<url>http://ecn.channel9.msdn.com/o9/previewImages/100/491006_100x75.jpg</url>
		<title>Channel 9 - Extreme ASP.NET Makeover: Mr. Escher, Your Software is Ready - Dependency</title>
		<link></link>
	</image>
	<description>
Extreme ASP.NET Makeover: Mr. Escher, Your Software is Ready –Dependency
As we saw, the Host class delegates to a whole host of Singletons (bad pun intended), including Settings, Users, Pages, Snippets, NavigationPaths, and AuthWriter. Each of these Singletons refers to other Singletons, creating a morass of dependencies. Before
 we start refactoring Host, we need some tests in place to ensure that we are not breaking anything. Configuration of the application and infrastructure is done by the ApplicationBootstrapper, which we introduced in Part 8. Our tests are going to execute ApplicationBootstrapper.Configure,
 as shown in Figure 2, and then verify that IHostV30 can be resolved from the IoC container as well as that various Singletons are still configured properly. Note that the IoC is initialized to null after every test to ensure that the tests don’t interfere
 with one another. 
Figure 2 Tests Execute ApplicationBootstrapper.Configure 
[TestFixture]public class AfterTheApplicationBootstraperIsExecuted {&amp;nbsp;&amp;nbsp;&amp;nbsp; [Test]&amp;nbsp;&amp;nbsp;&amp;nbsp; public void IHostCanBeResolvedFromTheContainer() {&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; IoC.Resolve&amp;lt;IHostV30&amp;gt;();&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp; [Test]&amp;nbsp;&amp;nbsp;&amp;nbsp; public void CacheInstanceIsInitialized() {&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Assert.That(Cache.Instance, Is.Not.Null);&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp; public void SettingsInstanceIsInitialized() {&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Assert.That(Settings.Instance, Is.Not.Null);&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp; [Test]&amp;nbsp;&amp;nbsp;&amp;nbsp; public void AuthReaderInstanceIsInitialized() {&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Assert.That(AuthReader.Instance, Is.Not.Null);&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp; [Test]&amp;nbsp;&amp;nbsp;&amp;nbsp; public void AuthWriterInstanceIsInitialized() {&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Assert.That(AuthWriter.Instance, Is.Not.Null);&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp; [SetUp]&amp;nbsp;&amp;nbsp;&amp;nbsp; public void SetUp() {&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; new ApplicationBootstrapper().Configure();&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp; [TearDown]&amp;nbsp;&amp;nbsp;&amp;nbsp; public void TearDown() {&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; IoC.Initialize(null);&amp;nbsp;&amp;nbsp;&amp;nbsp; }}

With these tests in place, let’s start refactoring Host to expose its dependency problems. 
Other videos from this article

Overview
Dependency
Host Users Dependency Cycle
Circular Dependency Cycle
Refactoring Notification

Read the full article at 
http://msdn.microsoft.com/magazine/ee470637.aspx 
</description>
	<link></link>
	<language>en</language>
	<pubDate>Sat, 25 May 2013 08:25:49 GMT</pubDate>
	<lastBuildDate>Sat, 25 May 2013 08:25:49 GMT</lastBuildDate>
	<generator>Rev9</generator>
</channel>
</rss>