Skip to content
This repository
Browse code

The final check in for 2.5.2

  • Loading branch information...
commit fb1755fb40e74f1a122154adaea557a1288578fd 1 parent 587aac1
Jeremy D. Miller authored January 12, 2009
381  Source/HTML/AutoMocker.htm
@@ -7,6 +7,385 @@
7 7
 		<script type="text/javascript" src="structuremap.js"></script>
8 8
 	</head>
9 9
 	<body>
10  
-	    Forthcoming... ETA:  1st Qtr 2009
  10
+	    <p>StructureMap includes an
  11
+            <a href="http://blog.eleutian.com/CommentView,guid,762249da-e25a-4503-8f20-c6d59b1a69bc.aspx">
  12
+            Auto Mocking Container</a> (a couple actually).&nbsp; If you&#39;re not familiar 
  13
+            with the concept, an Auto Mocking Container repurposes an IoC container to 
  14
+            automate the creation and attachment of mock objects to a concrete class within 
  15
+            unit tests.&nbsp; The key fact about any auto mocking container is that it 
  16
+            reduces the mechanical cost of creating
  17
+            <a href="http://codebetter.com/blogs/jeremy.miller/pages/129544.aspx">
  18
+            interaction tests</a> by obviating the need to create mock objects by hand, 
  19
+            track those mock objects in the test, and apply the mocks to a concrete class.&nbsp; 
  20
+            Out of the box, StructureMap includes the RhinoAutoMocker for
  21
+            <a href="http://ayende.com/projects/rhino-mocks.aspx">RhinoMocks</a> and 
  22
+            MoqAutoMocker for <a href="http://code.google.com/p/moq/">Moq</a>.&nbsp; The 
  23
+            Auto Mocking support is in the StructureMap.AutoMocking.dll.</p>
  24
+        <p>&nbsp;</p>
  25
+	    
  26
+	    <h2>How it Works</h2>
  27
+	    <p>Let&#39;s start with an example from the unit tests.&nbsp; Let&#39;s say that you have a 
  28
+            class named &quot;ConcreteClass&quot; that uses three other types of services to perform 
  29
+            its responsibilities.</p>
  30
+<!--
  31
+{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red0\green0\blue255;\red43\green145\blue175;}??\fs20             \cf3 public\cf0  ConcreteClass(\cf4 IMockedService\cf0  service, \cf4 IMockedService2\cf0  service2, \cf4 IMockedService3\cf0  service3)\par ??            \{\par ??                _service = service;\par ??                _service2 = service2;\par ??                _service3 = service3;\par ??            \}}
  32
+-->
  33
+        <div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border: black thin solid;">
  34
+            <p style="margin: 0px;">
  35
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">
  36
+                public</span> ConcreteClass(<span style="color: #2b91af;">IMockedService</span> 
  37
+                service, <span style="color: #2b91af;">IMockedService2</span> service2,
  38
+                <span style="color: #2b91af;">IMockedService3</span> service3)</p>
  39
+            <p style="margin: 0px;">
  40
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</p>
  41
+            <p style="margin: 0px;">
  42
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  43
+                _service = service;</p>
  44
+            <p style="margin: 0px;">
  45
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  46
+                _service2 = service2;</p>
  47
+            <p style="margin: 0px;">
  48
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  49
+                _service3 = service3;</p>
  50
+            <p style="margin: 0px;">
  51
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
  52
+        </div>
  53
+<!--EndFragment-->
  54
+<p>Traditionally, I might write integration tests against ConcreteClass by creating 
  55
+    a different mock object for each service dependency, attach each in the 
  56
+    constructor function of ConcreteClass, and probably track each mock object in a 
  57
+    field of the unit test fixture.&nbsp; With the auto mocking container, it&#39;s 
  58
+    simpler:</p>
  59
+<!--
  60
+{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red0\green128\blue0;\red0\green0\blue255;\red43\green145\blue175;}??\fs20             \cf3 // This sets up a Rhino Auto Mocker in the Arrange, Act, Assert mode\par ??\cf0             \cf4 var\cf0  autoMocker = \cf4 new\cf0  \cf5 RhinoAutoMocker\cf0 &lt;\cf5 ConcreteClass\cf0 &gt;(\cf5 MockMode\cf0 .AAA);}
  61
+-->
  62
+        <div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border: black thin solid;">
  63
+            <p style="margin: 0px;">
  64
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: green;">
  65
+                // This sets up a Rhino Auto Mocker in the Arrange, Act, Assert mode</span></p>
  66
+            <p style="margin: 0px;">
  67
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">
  68
+                var</span> autoMocker = <span style="color: blue;">new</span>
  69
+                <span style="color: #2b91af;">RhinoAutoMocker</span>&lt;<span 
  70
+                    style="color: #2b91af;">ConcreteClass</span>&gt;(<span style="color: #2b91af;">MockMode</span>.AAA);</p>
  71
+        </div>
  72
+<!--EndFragment-->
  73
+<p>That&#39;s the entire mock object setup.&nbsp; To get an instance of the 
  74
+    ConcreteClass inside the unit test you access the ClassUnderTest property of the 
  75
+    auto mocker:</p>
  76
+<!--
  77
+{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red0\green128\blue0;\red43\green145\blue175;}??\fs20             \cf3 // Act in the test\par ??\cf0             \cf4 ConcreteClass\cf0  @class = autoMocker.ClassUnderTest;\par ??            @class.CallService();}
  78
+-->
  79
+        <div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border: black thin solid;">
  80
+            <p style="margin: 0px;">
  81
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: green;">
  82
+                // Act in the test</span></p>
  83
+            <p style="margin: 0px;">
  84
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: #2b91af;">
  85
+                ConcreteClass</span> @class = autoMocker.ClassUnderTest;</p>
  86
+            <p style="margin: 0px;">
  87
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @class.CallService();</p>
  88
+        </div>
  89
+<!--EndFragment-->
  90
+<p>At the first call to the RhinoAutoMocker.ClassUnderTest, the RhinoAutoMocker:</p>
  91
+        <ol>
  92
+            <li>&nbsp;Looked at ConcreteClass</li>
  93
+            <li>Saw that the greediest constructor required instances of three different 
  94
+                dependencies</li>
  95
+            <li>Created mock objects using the RhinoMocks MockRepository.CreateMock&lt;T&gt;() method 
  96
+                for each type of dependency</li>
  97
+            <li>Then called the constructor function of ConcreteClass to build a new instance</li>
  98
+        </ol>
  99
+        <p>
  100
+            ClassUnderTest is created upon demand.&nbsp; Likewise, you can access the actual 
  101
+            mock objects either to set expectations before ClassUnderTest is created, or to 
  102
+            assert method calls after the action.&nbsp; Use the Get&lt;T&gt;() method to access 
  103
+            the mock objects per type that will be used in the test:</p>
  104
+<!--
  105
+{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red0\green128\blue0;\red43\green145\blue175;}??\fs20             \cf3 // This retrieves the mock object for IMockedService\par ??\cf0             autoMocker.Get&lt;\cf4 IMockedService\cf0 &gt;().AssertWasCalled(s =&gt; s.Go());}
  106
+-->
  107
+        <div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border: black thin solid;">
  108
+            <p style="margin: 0px;">
  109
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: green;">
  110
+                // This retrieves the mock object for IMockedService</span></p>
  111
+            <p style="margin: 0px;">
  112
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; autoMocker.Get&lt;<span 
  113
+                    style="color: #2b91af;">IMockedService</span>&gt;().AssertWasCalled(s =&gt; 
  114
+                s.Go());</p>
  115
+        </div>
  116
+<!--EndFragment-->
  117
+<hr />
  118
+	    
  119
+	    <h2>How it uses Mock Engines</h2>
  120
+	    <p>If you wanted to use the AutoMocker with another type of Mock Object Library, you 
  121
+            can simply use the AutoMocker&lt;CLASSUNDERTEST&gt; class, but feed it an 
  122
+            implementation of this interface that works with the mock object library of your 
  123
+            choice:</p>
  124
+<!--
  125
+{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red0\green0\blue255;\red43\green145\blue175;}??\fs20     \cf3 public\cf0  \cf3 interface\cf0  \cf4 ServiceLocator\par ??\cf0     \{\par ??        T Service&lt;T&gt;() \cf3 where\cf0  T : \cf3 class\cf0 ;\par ??        \cf3 object\cf0  Service(\cf4 Type\cf0  serviceType);\par ??        T PartialMock&lt;T&gt;(\cf3 params\cf0  \cf3 object\cf0 [] args) \cf3 where\cf0  T : \cf3 class\cf0 ;\par ??    \}}
  126
+-->
  127
+        <div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border: black thin solid;">
  128
+            <p style="margin: 0px;">
  129
+&nbsp;&nbsp;&nbsp; <span style="color: blue;">public</span> <span style="color: blue;">interface</span>
  130
+                <span style="color: #2b91af;">ServiceLocator</span></p>
  131
+            <p style="margin: 0px;">
  132
+&nbsp;&nbsp;&nbsp; {</p>
  133
+            <p style="margin: 0px;">
  134
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; T Service&lt;T&gt;() <span style="color: blue;">where</span> 
  135
+                T : <span style="color: blue;">class</span>;</p>
  136
+            <p style="margin: 0px;">
  137
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">object</span> Service(<span 
  138
+                    style="color: #2b91af;">Type</span> serviceType);</p>
  139
+            <p style="margin: 0px;">
  140
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; T PartialMock&lt;T&gt;(<span style="color: blue;">params</span>
  141
+                <span style="color: blue;">object</span>[] args) <span style="color: blue;">
  142
+                where</span> T : <span style="color: blue;">class</span>;</p>
  143
+            <p style="margin: 0px;">
  144
+&nbsp;&nbsp;&nbsp; }</p>
  145
+        </div>
  146
+<!--EndFragment-->
  147
+<p>The RhinoMocks &quot;AAA&quot; mode is shown below:</p>
  148
+<!--
  149
+{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red0\green0\blue255;\red43\green145\blue175;}??\fs20     \cf3 public\cf0  \cf3 class\cf0  \cf4 RhinoMocksAAAServiceLocator\cf0  : \cf4 ServiceLocator\par ??\cf0     \{\par ??        \cf3 private\cf0  \cf3 readonly\cf0  \cf4 RhinoMockRepositoryProxy\cf0  _mocks = \cf3 new\cf0  \cf4 RhinoMockRepositoryProxy\cf0 ();\par ??\par ??        \cf3 public\cf0  T Service&lt;T&gt;() \cf3 where\cf0  T : \cf3 class\par ??\cf0         \{\par ??            \cf3 var\cf0  instance = (T)_mocks.DynamicMock(\cf3 typeof\cf0  (T));\par ??            _mocks.Replay(instance);\par ??            \cf3 return\cf0  instance;\par ??        \}\par ??\par ??        \cf3 public\cf0  \cf3 object\cf0  Service(\cf4 Type\cf0  serviceType)\par ??        \{\par ??            \cf3 var\cf0  instance = _mocks.DynamicMock(serviceType);\par ??            _mocks.Replay(instance);\par ??            \cf3 return\cf0  instance;\par ??        \}\par ??\par ??        \cf3 public\cf0  T PartialMock&lt;T&gt;(\cf3 params\cf0  \cf3 object\cf0 [] args) \cf3 where\cf0  T : \cf3 class\par ??\cf0         \{\par ??            \cf3 var\cf0  instance = (T)_mocks.PartialMock(\cf3 typeof\cf0 (T), args);\par ??            _mocks.Replay(instance);\par ??            \cf3 return\cf0  instance;\par ??        \}\par ??    \}}
  150
+-->
  151
+        <div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border: black thin solid;">
  152
+            <p style="margin: 0px;">
  153
+&nbsp;&nbsp;&nbsp; <span style="color: blue;">public</span> <span style="color: blue;">class</span>
  154
+                <span style="color: #2b91af;">RhinoMocksAAAServiceLocator</span> :
  155
+                <span style="color: #2b91af;">ServiceLocator</span></p>
  156
+            <p style="margin: 0px;">
  157
+&nbsp;&nbsp;&nbsp; {</p>
  158
+            <p style="margin: 0px;">
  159
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">private</span>
  160
+                <span style="color: blue;">readonly</span> <span style="color: #2b91af;">
  161
+                RhinoMockRepositoryProxy</span> _mocks = <span style="color: blue;">new</span>
  162
+                <span style="color: #2b91af;">RhinoMockRepositoryProxy</span>();</p>
  163
+            <p style="margin: 0px;">
  164
+                &nbsp;</p>
  165
+            <p style="margin: 0px;">
  166
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">public</span> T 
  167
+                Service&lt;T&gt;() <span style="color: blue;">where</span> T :
  168
+                <span style="color: blue;">class</span></p>
  169
+            <p style="margin: 0px;">
  170
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</p>
  171
+            <p style="margin: 0px;">
  172
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">
  173
+                var</span> instance = (T)_mocks.DynamicMock(<span style="color: blue;">typeof</span> 
  174
+                (T));</p>
  175
+            <p style="margin: 0px;">
  176
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _mocks.Replay(instance);</p>
  177
+            <p style="margin: 0px;">
  178
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">
  179
+                return</span> instance;</p>
  180
+            <p style="margin: 0px;">
  181
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
  182
+            <p style="margin: 0px;">
  183
+                &nbsp;</p>
  184
+            <p style="margin: 0px;">
  185
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">public</span>
  186
+                <span style="color: blue;">object</span> Service(<span style="color: #2b91af;">Type</span> 
  187
+                serviceType)</p>
  188
+            <p style="margin: 0px;">
  189
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</p>
  190
+            <p style="margin: 0px;">
  191
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">
  192
+                var</span> instance = _mocks.DynamicMock(serviceType);</p>
  193
+            <p style="margin: 0px;">
  194
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _mocks.Replay(instance);</p>
  195
+            <p style="margin: 0px;">
  196
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">
  197
+                return</span> instance;</p>
  198
+            <p style="margin: 0px;">
  199
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
  200
+            <p style="margin: 0px;">
  201
+                &nbsp;</p>
  202
+            <p style="margin: 0px;">
  203
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">public</span> T 
  204
+                PartialMock&lt;T&gt;(<span style="color: blue;">params</span>
  205
+                <span style="color: blue;">object</span>[] args) <span style="color: blue;">
  206
+                where</span> T : <span style="color: blue;">class</span></p>
  207
+            <p style="margin: 0px;">
  208
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</p>
  209
+            <p style="margin: 0px;">
  210
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">
  211
+                var</span> instance = (T)_mocks.PartialMock(<span style="color: blue;">typeof</span>(T), 
  212
+                args);</p>
  213
+            <p style="margin: 0px;">
  214
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _mocks.Replay(instance);</p>
  215
+            <p style="margin: 0px;">
  216
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">
  217
+                return</span> instance;</p>
  218
+            <p style="margin: 0px;">
  219
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
  220
+            <p style="margin: 0px;">
  221
+&nbsp;&nbsp;&nbsp; }</p>
  222
+        </div>
  223
+<!--EndFragment-->
  224
+<p>And this is the Moq version:</p>
  225
+<!--
  226
+{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red0\green0\blue255;\red43\green145\blue175;}??\fs20     \cf3 public\cf0  \cf3 class\cf0  \cf4 MoqServiceLocator\cf0  : \cf4 ServiceLocator\par ??\cf0     \{\par ??        \cf3 private\cf0  \cf3 readonly\cf0  \cf4 MoqFactory\cf0  _moqs = \cf3 new\cf0  \cf4 MoqFactory\cf0 ();\par ??        \par ??        \cf3 public\cf0  T Service&lt;T&gt;() \cf3 where\cf0  T : \cf3 class\par ??\cf0         \{\par ??            \cf3 return\cf0  (T)_moqs.CreateMock(\cf3 typeof\cf0 (T));\par ??        \}\par ??\par ??        \cf3 public\cf0  \cf3 object\cf0  Service(\cf4 Type\cf0  serviceType)\par ??        \{\par ??            \cf3 return\cf0  _moqs.CreateMock(serviceType);\par ??        \}\par ??\par ??        \cf3 public\cf0  T PartialMock&lt;T&gt;(\cf3 params\cf0  \cf3 object\cf0 [] args) \cf3 where\cf0  T : \cf3 class\par ??\cf0         \{\par ??            \cf3 return\cf0  (T)_moqs.CreateMockThatCallsBase(\cf3 typeof\cf0  (T), args);\par ??        \}\par ??    \}}
  227
+-->
  228
+        <div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border: black thin solid;">
  229
+            <p style="margin: 0px;">
  230
+&nbsp;&nbsp;&nbsp; <span style="color: blue;">public</span> <span style="color: blue;">class</span>
  231
+                <span style="color: #2b91af;">MoqServiceLocator</span> :
  232
+                <span style="color: #2b91af;">ServiceLocator</span></p>
  233
+            <p style="margin: 0px;">
  234
+&nbsp;&nbsp;&nbsp; {</p>
  235
+            <p style="margin: 0px;">
  236
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">private</span>
  237
+                <span style="color: blue;">readonly</span> <span style="color: #2b91af;">
  238
+                MoqFactory</span> _moqs = <span style="color: blue;">new</span>
  239
+                <span style="color: #2b91af;">MoqFactory</span>();</p>
  240
+            <p style="margin: 0px;">
  241
+                &nbsp;</p>
  242
+            <p style="margin: 0px;">
  243
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">public</span> T 
  244
+                Service&lt;T&gt;() <span style="color: blue;">where</span> T :
  245
+                <span style="color: blue;">class</span></p>
  246
+            <p style="margin: 0px;">
  247
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</p>
  248
+            <p style="margin: 0px;">
  249
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">
  250
+                return</span> (T)_moqs.CreateMock(<span style="color: blue;">typeof</span>(T));</p>
  251
+            <p style="margin: 0px;">
  252
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
  253
+            <p style="margin: 0px;">
  254
+                &nbsp;</p>
  255
+            <p style="margin: 0px;">
  256
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">public</span>
  257
+                <span style="color: blue;">object</span> Service(<span style="color: #2b91af;">Type</span> 
  258
+                serviceType)</p>
  259
+            <p style="margin: 0px;">
  260
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</p>
  261
+            <p style="margin: 0px;">
  262
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">
  263
+                return</span> _moqs.CreateMock(serviceType);</p>
  264
+            <p style="margin: 0px;">
  265
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
  266
+            <p style="margin: 0px;">
  267
+                &nbsp;</p>
  268
+            <p style="margin: 0px;">
  269
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">public</span> T 
  270
+                PartialMock&lt;T&gt;(<span style="color: blue;">params</span>
  271
+                <span style="color: blue;">object</span>[] args) <span style="color: blue;">
  272
+                where</span> T : <span style="color: blue;">class</span></p>
  273
+            <p style="margin: 0px;">
  274
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</p>
  275
+            <p style="margin: 0px;">
  276
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">
  277
+                return</span> (T)_moqs.CreateMockThatCallsBase(<span style="color: blue;">typeof</span> 
  278
+                (T), args);</p>
  279
+            <p style="margin: 0px;">
  280
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
  281
+            <p style="margin: 0px;">
  282
+&nbsp;&nbsp;&nbsp; }</p>
  283
+        </div>
  284
+<!--EndFragment-->
  285
+<hr />
  286
+	    
  287
+	    <h2>Supplying Mocks or Stubs to the AutoMocker</h2>
  288
+	    <p>Frequently you may want to use the AutoMocker, but override the normal mock 
  289
+            object creation with your own stub or hand rolled mock objects.&nbsp; That&#39;s 
  290
+            easy enough with the Inject() methods:</p>
  291
+<!--
  292
+{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red128\green128\blue128;\red0\green128\blue0;\red0\green0\blue255;\red43\green145\blue175;}??\fs20         \cf3 ///\cf4  \cf3 &lt;summary&gt;\par ??\cf0         \cf3 ///\cf4  Method to specify the exact object that will be used for \par ??\cf0         \cf3 ///\cf4  "pluginType."  Useful for stub objects and/or static mocks\par ??\cf0         \cf3 ///\cf4  \cf3 &lt;/summary&gt;\par ??\cf0         \cf3 ///\cf4  \cf3 &lt;param name="pluginType"&gt;&lt;/param&gt;\par ??\cf0         \cf3 ///\cf4  \cf3 &lt;param name="stub"&gt;&lt;/param&gt;\par ??\cf0         \cf5 void\cf0  Inject(\cf6 Type\cf0  pluginType, \cf5 object\cf0  stub);\par ??\par ??        \cf3 ///\cf4  \cf3 &lt;summary&gt;\par ??\cf0         \cf3 ///\cf4  Method to specify the exact object that will be used for \par ??\cf0         \cf3 ///\cf4  "pluginType."  Useful for stub objects and/or static mocks\par ??\cf0         \cf3 ///\cf4  \cf3 &lt;/summary&gt;\par ??\cf0         \cf3 ///\cf4  \cf3 &lt;typeparam name="T"&gt;&lt;/typeparam&gt;\par ??\cf0         \cf3 ///\cf4  \cf3 &lt;param name="target"&gt;&lt;/param&gt;\par ??\cf0         \cf5 void\cf0  Inject&lt;T&gt;(T target);}
  293
+-->
  294
+        <div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border: black thin solid;">
  295
+            <p style="margin: 0px;">
  296
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: gray;">///</span><span 
  297
+                    style="color: green;"> </span><span style="color: gray;">&lt;summary&gt;</span></p>
  298
+            <p style="margin: 0px;">
  299
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: gray;">///</span><span 
  300
+                    style="color: green;"> Method to specify the exact object that will be used 
  301
+                for </span>
  302
+            </p>
  303
+            <p style="margin: 0px;">
  304
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: gray;">///</span><span 
  305
+                    style="color: green;"> &quot;pluginType.&quot;&nbsp; Useful for stub objects and/or 
  306
+                static mocks</span></p>
  307
+            <p style="margin: 0px;">
  308
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: gray;">///</span><span 
  309
+                    style="color: green;"> </span><span style="color: gray;">&lt;/summary&gt;</span></p>
  310
+            <p style="margin: 0px;">
  311
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: gray;">///</span><span 
  312
+                    style="color: green;"> </span><span style="color: gray;">&lt;param 
  313
+                name=&quot;pluginType&quot;&gt;&lt;/param&gt;</span></p>
  314
+            <p style="margin: 0px;">
  315
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: gray;">///</span><span 
  316
+                    style="color: green;"> </span><span style="color: gray;">&lt;param 
  317
+                name=&quot;stub&quot;&gt;&lt;/param&gt;</span></p>
  318
+            <p style="margin: 0px;">
  319
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">void</span> Inject(<span 
  320
+                    style="color: #2b91af;">Type</span> pluginType, <span style="color: blue;">
  321
+                object</span> stub);</p>
  322
+            <p style="margin: 0px;">
  323
+                &nbsp;</p>
  324
+            <p style="margin: 0px;">
  325
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: gray;">///</span><span 
  326
+                    style="color: green;"> </span><span style="color: gray;">&lt;summary&gt;</span></p>
  327
+            <p style="margin: 0px;">
  328
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: gray;">///</span><span 
  329
+                    style="color: green;"> Method to specify the exact object that will be used 
  330
+                for </span>
  331
+            </p>
  332
+            <p style="margin: 0px;">
  333
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: gray;">///</span><span 
  334
+                    style="color: green;"> &quot;pluginType.&quot;&nbsp; Useful for stub objects and/or 
  335
+                static mocks</span></p>
  336
+            <p style="margin: 0px;">
  337
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: gray;">///</span><span 
  338
+                    style="color: green;"> </span><span style="color: gray;">&lt;/summary&gt;</span></p>
  339
+            <p style="margin: 0px;">
  340
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: gray;">///</span><span 
  341
+                    style="color: green;"> </span><span style="color: gray;">&lt;typeparam 
  342
+                name=&quot;T&quot;&gt;&lt;/typeparam&gt;</span></p>
  343
+            <p style="margin: 0px;">
  344
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: gray;">///</span><span 
  345
+                    style="color: green;"> </span><span style="color: gray;">&lt;param 
  346
+                name=&quot;target&quot;&gt;&lt;/param&gt;</span></p>
  347
+            <p style="margin: 0px;">
  348
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">void</span> Inject&lt;T&gt;(T 
  349
+                target);</p>
  350
+        </div>
  351
+<!--EndFragment-->
  352
+<hr />
  353
+	    
  354
+	    <h2>Partial Mock the ClassUnderTest</h2>
  355
+	    <p>Every so often, I find it useful to create a &quot;<a 
  356
+                href="http://ayende.com/wiki/Rhino+Mocks+Partial+Mocks.ashx">partial mock</a>&quot; 
  357
+            for the ClassUnderTest.&nbsp; That can be done with the AutoMocker by calling 
  358
+            the PartialMockTheClassUnderTest() method:</p>
  359
+<!--
  360
+{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red0\green0\blue255;\red43\green145\blue175;}??\fs20             \cf3 var\cf0  autoMocker = createAutoMocker&lt;\cf4 ConcreteClass\cf0 &gt;();\par ??\par ??            \cf3 var\cf0  service = autoMocker.Get&lt;\cf4 IMockedService\cf0 &gt;();\par ??            \cf3 var\cf0  service2 = autoMocker.Get&lt;\cf4 IMockedService2\cf0 &gt;();\par ??            \cf3 var\cf0  service3 = autoMocker.Get&lt;\cf4 IMockedService3\cf0 &gt;();\par ??\par ??            autoMocker.PartialMockTheClassUnderTest();}
  361
+-->
  362
+        <div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border: black thin solid;">
  363
+            <p style="margin: 0px;">
  364
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">
  365
+                var</span> autoMocker = createAutoMocker&lt;<span style="color: #2b91af;">ConcreteClass</span>&gt;();</p>
  366
+            <p style="margin: 0px;">
  367
+                &nbsp;</p>
  368
+            <p style="margin: 0px;">
  369
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">
  370
+                var</span> service = autoMocker.Get&lt;<span style="color: #2b91af;">IMockedService</span>&gt;();</p>
  371
+            <p style="margin: 0px;">
  372
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">
  373
+                var</span> service2 = autoMocker.Get&lt;<span style="color: #2b91af;">IMockedService2</span>&gt;();</p>
  374
+            <p style="margin: 0px;">
  375
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">
  376
+                var</span> service3 = autoMocker.Get&lt;<span style="color: #2b91af;">IMockedService3</span>&gt;();</p>
  377
+            <p style="margin: 0px;">
  378
+                &nbsp;</p>
  379
+            <p style="margin: 0px;">
  380
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  381
+                autoMocker.PartialMockTheClassUnderTest();</p>
  382
+        </div>
  383
+<!--EndFragment-->
  384
+<p>Expectations and assertions can be made directly on the AutoMocker.ClassUnderTest 
  385
+    property.&nbsp; When the PartialMockTheClassUnderTest() method is called, the 
  386
+    underlying value behind ClassUnderTest will be a partial mock, but the 
  387
+    AutoMocker will still use mock objects for the dependencies of the class under 
  388
+    test.</p>
  389
+	    <hr />
11 390
 	</body>
12 391
 </html>
21  Source/HTML/DependencyInjection.htm
@@ -22,8 +22,7 @@
22 22
             still thinks it&#39;s much cleaner to use DI ;-)</p>
23 23
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
24 24
             &nbsp;</p>
25  
-        <h2 style="margin: 0in 0in 0pt;">
26  
-            Dependency Injection</h2>
  25
+        <h2>Dependency Injection</h2>
27 26
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
28 27
             &nbsp;</p>
29 28
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
@@ -76,8 +75,7 @@ <h2 style="margin: 0in 0in 0pt;">
76 75
         <hr />
77 76
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
78 77
             <o:p>&nbsp;</o:p></p>
79  
-        <h2 style="margin: 0in 0in 0pt;">
80  
-            <b style="">Example Problem<o:p></o:p></b></h2>
  78
+        <h2>Example Problem</h2>
81 79
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
82 80
             <b style=""><o:p>&nbsp;</o:p></b></p>
83 81
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
@@ -277,8 +275,7 @@ <h2 style="margin: 0in 0in 0pt;">
277 275
         <hr />
278 276
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
279 277
             <o:p>&nbsp;</o:p></p>
280  
-        <h2 style="margin: 0in 0in 0pt;">
281  
-            <b style=""><span class="style1">Constructor Injection</span><o:p></o:p></b></h2>
  278
+        <h2>Constructor Injection</h2>
282 279
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
283 280
             <b style=""><o:p>&nbsp;</o:p></b></p>
284 281
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
@@ -475,8 +472,7 @@ <h2 style="margin: 0in 0in 0pt;">
475 472
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
476 473
             <b style=""><o:p>&nbsp;</o:p></b></p>
477 474
         <hr />
478  
-        <h2 style="margin: 0in 0in 0pt;">
479  
-            <b style=""><span class="style1">Setter Injection</span><o:p></o:p></b></h2>
  475
+        <h2>Setter Injection</h2>
480 476
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
481 477
             <o:p>&nbsp;</o:p></p>
482 478
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
@@ -719,8 +715,7 @@ <h2 style="margin: 0in 0in 0pt;">
719 715
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
720 716
             <o:p>&nbsp;</o:p></p>
721 717
         <hr />
722  
-        <h2 style="margin: 0in 0in 0pt;">
723  
-            <b style=""><span class="style1">Service Locator</span><o:p></o:p></b></h2>
  718
+        <h2>Service Locator</h2>
724 719
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
725 720
             <b style=""><o:p>&nbsp;</o:p></b></p>
726 721
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
@@ -875,8 +870,7 @@ <h2 style="margin: 0in 0in 0pt;">
875 870
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
876 871
             <o:p>&nbsp;</o:p></p>
877 872
         <hr />
878  
-        <h2 style="margin: 0in 0in 0pt;">
879  
-            <span style="">Good for More than Unit Testing<o:p></o:p></span></h2>
  873
+        <h2>Good for More than Unit Testing</h2>
880 874
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
881 875
             <b style=""><o:p>&nbsp;</o:p></b></p>
882 876
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
@@ -1034,8 +1028,7 @@ <h2 style="margin: 0in 0in 0pt;">
1034 1028
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
1035 1029
             &nbsp;</p>
1036 1030
         <hr />
1037  
-        <h2 style="margin: 0in 0in 0pt;">
1038  
-            <span style="">Using a Dependency Injection Tool<o:p></o:p></span></h2>
  1031
+        <h2>Using a Dependency Injection Tool</h2>
1039 1032
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
1040 1033
             &nbsp;</p>
1041 1034
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
5  Source/HTML/HTML.csproj
@@ -66,6 +66,8 @@
66 66
     <Content Include="InversionOfControl.htm" />
67 67
     <Content Include="Profiles.htm" />
68 68
     <Content Include="Scoping.htm" />
  69
+    <Content Include="TableOfContents.htm" />
  70
+    <Content Include="ToC-Bullet-List.xml" />
69 71
     <Content Include="UsingAttributes.htm" />
70 72
     <Content Include="AutoWiring.htm" />
71 73
     <Content Include="ConfiguringStructureMap.htm" />
@@ -113,4 +115,7 @@
113 115
       <Install>false</Install>
114 116
     </BootstrapperPackage>
115 117
   </ItemGroup>
  118
+  <ItemGroup>
  119
+    <None Include="StructureMap.chm" />
  120
+  </ItemGroup>
116 121
 </Project>
9  Source/HTML/InversionOfControl.htm
@@ -28,8 +28,7 @@
28 28
             <o:p>&nbsp;</o:p></p>
29 29
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
30 30
             <o:p>&nbsp;</o:p></p>
31  
-        <h2 style="margin: 0in 0in 0pt;">
32  
-            <b style=""><span class="style1">Real Life Example</span><o:p></o:p></b></h2>
  31
+        <h2>Real Life Example</h2>
33 32
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
34 33
             <b style=""><o:p>&nbsp;</o:p></b></p>
35 34
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
@@ -352,8 +351,7 @@ <h2 style="margin: 0in 0in 0pt;">
352 351
         </ul>
353 352
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
354 353
             <o:p>&nbsp;</o:p></p>
355  
-        <h2 style="margin: 0in 0in 0pt;">
356  
-            <b style="">Refactoring to Inversion of Control<o:p></o:p></b></h2>
  354
+        <h2>Refactoring to Inversion of Control</h2>
357 355
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
358 356
             <o:p>&nbsp;</o:p></p>
359 357
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
@@ -559,8 +557,7 @@ <h2 style="margin: 0in 0in 0pt;">
559 557
         </p>
560 558
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
561 559
             <o:p>&nbsp;</o:p></p>
562  
-        <h2 style="margin: 0in 0in 0pt;">
563  
-            <b style="">Other Examples<o:p></o:p></b></h2>
  560
+        <h2>Other Examples</h2>
564 561
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
565 562
             <b style=""><o:p>&nbsp;</o:p></b></p>
566 563
         <p class="MsoNormal" style="margin: 0in 0in 0pt;">
3  Source/HTML/Menu.htm
@@ -13,8 +13,9 @@
13 13
     <li><a href="http://dimecasts.net/Casts/ByTag/StructureMap">StructureMap on DimeCasts</a></li>
14 14
     <li><a href="http://teamcity.codebetter.com/viewType.html?buildTypeId=bt5&amp;tab=buildTypeStatusDiv">
15 15
         StructureMap CI Server on TeamCity.Codebetter.com</a></li>
16  
-    <li>Full Table of Contents</li>
  16
+    <li><a href="TableOfContents.htm">Full Table of Contents</a></li>
17 17
     <li><a href="FeatureList.htm">Feature List</a></li>
  18
+    <li><a href="StructureMap.chm">API Documentation</a></li>
18 19
 </ul>
19 20
 <br />
20 21
 <ul>
BIN  Source/HTML/StructureMap.chm
Binary file not shown
24  Source/HTML/TableOfContents.htm
... ...
@@ -0,0 +1,24 @@
  1
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2
+<html>
  3
+	<head>
  4
+		<title>Table of Contents</title>
  5
+		<link rel="stylesheet" type="text/css" href="style.css" />
  6
+		<script type="text/javascript" src="jquery-1.2.6.js"></script>
  7
+		<script type="text/javascript" src="structuremap.js"></script>
  8
+	</head>
  9
+	<body>
  10
+	    <script language="javascript">
  11
+	        $(document).ready(function() {
  12
+	            $.get('ToC-Bullet-List.xml', {}, writeTOC, 'HTML');
  13
+	        });
  14
+
  15
+	        function writeTOC(data) {
  16
+	            $('#main').html(data);
  17
+	        }
  18
+	    </script>
  19
+	
  20
+	    <div id="main">
  21
+	    
  22
+	    </div>
  23
+	</body>
  24
+</html>
835  Source/HTML/ToC-Bullet-List.xml
... ...
@@ -0,0 +1,835 @@
  1
+<div>
  2
+  <ul>
  3
+    <li>
  4
+      <a href="default.htm">Home</a>
  5
+      <ul>
  6
+        <li>
  7
+          <a href="default.htm#section0">Status</a>
  8
+          <ul />
  9
+        </li>
  10
+        <li>
  11
+          <a href="default.htm#section1">Related Links:</a>
  12
+          <ul />
  13
+        </li>
  14
+      </ul>
  15
+    </li>
  16
+    <li>
  17
+      <a href="FeatureList.htm">Feature List</a>
  18
+      <ul />
  19
+    </li>
  20
+    <li>
  21
+      <a href="QuickStart.htm">A Gentle Quickstart</a>
  22
+      <ul>
  23
+        <li>
  24
+          <a href="QuickStart.htm#section0">Salient Facts</a>
  25
+          <ul />
  26
+        </li>
  27
+        <li>
  28
+          <a href="QuickStart.htm#section1">The Simplest Possible Usage of StructureMap</a>
  29
+          <ul />
  30
+        </li>
  31
+        <li>
  32
+          <a href="QuickStart.htm#section2">Primitive Arguments</a>
  33
+          <ul />
  34
+        </li>
  35
+        <li>
  36
+          <a href="QuickStart.htm#section3">Auto Wiring</a>
  37
+          <ul />
  38
+        </li>
  39
+        <li>
  40
+          <a href="QuickStart.htm#section4">What to do when things go wrong?</a>
  41
+          <ul />
  42
+        </li>
  43
+      </ul>
  44
+    </li>
  45
+    <li>
  46
+      <a href="Glossary.htm">Glossary</a>
  47
+      <ul>
  48
+        <li>
  49
+          <a href="Glossary.htm#section0">Container</a>
  50
+          <ul />
  51
+        </li>
  52
+        <li>
  53
+          <a href="Glossary.htm#section1">PluginType &amp;amp; PluggedType</a>
  54
+          <ul />
  55
+        </li>
  56
+        <li>
  57
+          <a href="Glossary.htm#section2">Instance</a>
  58
+          <ul />
  59
+        </li>
  60
+        <li>
  61
+          <a href="Glossary.htm#section3">Scoping (or Lifecycle)</a>
  62
+          <ul />
  63
+        </li>
  64
+        <li>
  65
+          <a href="Glossary.htm#section4">Profile</a>
  66
+          <ul />
  67
+        </li>
  68
+        <li>
  69
+          <a href="Glossary.htm#section5">Interceptor</a>
  70
+          <ul />
  71
+        </li>
  72
+      </ul>
  73
+    </li>
  74
+    <li>
  75
+      <a href="Concepts.htm">Software Design Concepts</a>
  76
+      <ul>
  77
+        <li>
  78
+          <a href="Concepts.htm#section0">Design Concepts</a>
  79
+          <ul />
  80
+        </li>
  81
+        <li>
  82
+          <a href="Concepts.htm#section1">Dependencies</a>
  83
+          <ul />
  84
+        </li>
  85
+        <li>
  86
+          <a href="Concepts.htm#section2">Inversion of Control and Dependency Injection</a>
  87
+          <ul />
  88
+        </li>
  89
+        <li>
  90
+          <a href="Concepts.htm#section3">Auto Wiring</a>
  91
+          <ul />
  92
+        </li>
  93
+      </ul>
  94
+    </li>
  95
+    <li>
  96
+      <a href="DependencyInjection.htm">Dependency Injection</a>
  97
+      <ul>
  98
+        <li>
  99
+          <a href="DependencyInjection.htm#section0">Dependency Injection</a>
  100
+          <ul />
  101
+        </li>
  102
+        <li>
  103
+          <a href="DependencyInjection.htm#section1">Example Problem</a>
  104
+          <ul />
  105
+        </li>
  106
+        <li>
  107
+          <a href="DependencyInjection.htm#section2">Constructor Injection</a>
  108
+          <ul />
  109
+        </li>
  110
+        <li>
  111
+          <a href="DependencyInjection.htm#section3">Setter Injection</a>
  112
+          <ul />
  113
+        </li>
  114
+        <li>
  115
+          <a href="DependencyInjection.htm#section4">Service Locator</a>
  116
+          <ul />
  117
+        </li>
  118
+        <li>
  119
+          <a href="DependencyInjection.htm#section5">Good for More than Unit Testing</a>
  120
+          <ul />
  121
+        </li>
  122
+        <li>
  123
+          <a href="DependencyInjection.htm#section6">Using a Dependency Injection Tool</a>
  124
+          <ul />
  125
+        </li>
  126
+      </ul>
  127
+    </li>
  128
+    <li>
  129
+      <a href="InversionOfControl.htm">Inversion of Control</a>
  130
+      <ul>
  131
+        <li>
  132
+          <a href="InversionOfControl.htm#section0">Real Life Example</a>
  133
+          <ul />
  134
+        </li>
  135
+        <li>
  136
+          <a href="InversionOfControl.htm#section1">Refactoring to Inversion of Control</a>
  137
+          <ul />
  138
+        </li>
  139
+        <li>
  140
+          <a href="InversionOfControl.htm#section2">Other Examples</a>
  141
+          <ul />
  142
+        </li>
  143
+      </ul>
  144
+    </li>
  145
+    <li>
  146
+      <a href="ConfiguringStructureMap.htm">Configuring StructureMap</a>
  147
+      <ul>
  148
+        <li>
  149
+          <a href="ConfiguringStructureMap.htm#section0">Forms of Configuration</a>
  150
+          <ul />
  151
+        </li>
  152
+        <li>
  153
+          <a href="ConfiguringStructureMap.htm#section1">Initializing the Container</a>
  154
+          <ul>
  155
+            <li>
  156
+              <a href="ConfiguringStructureMap.htm#section2">Using the App.Config File</a>
  157
+            </li>
  158
+            <li>
  159
+              <a href="ConfiguringStructureMap.htm#section3">The StructureMap.config File</a>
  160
+            </li>
  161
+          </ul>
  162
+        </li>
  163
+        <li>
  164
+          <a href="ConfiguringStructureMap.htm#section4">Where and How to Bootstrap StructureMap</a>
  165
+          <ul>
  166
+            <li>
  167
+              <a href="ConfiguringStructureMap.htm#section5">Creating a Bootstrapper</a>
  168
+            </li>
  169
+            <li>
  170
+              <a href="ConfiguringStructureMap.htm#section6">StructureMapConfiguration</a>
  171
+            </li>
  172
+          </ul>
  173
+        </li>
  174
+      </ul>
  175
+    </li>
  176
+    <li>
  177
+      <a href="RegistryDSL.htm">Registry DSL</a>
  178
+      <ul>
  179
+        <li>
  180
+          <a href="RegistryDSL.htm#section0">The Registry Class</a>
  181
+          <ul>
  182
+            <li>
  183
+              <a href="RegistryDSL.htm#section1">Applying Registry Classes</a>
  184
+            </li>
  185
+            <li>
  186
+              <a href="RegistryDSL.htm#section2">The Registry DSL Methods</a>
  187
+            </li>
  188
+          </ul>
  189
+        </li>
  190
+        <li>
  191
+          <a href="RegistryDSL.htm#section3">Registering Types</a>
  192
+          <ul>
  193
+            <li>
  194
+              <a href="RegistryDSL.htm#section4">Specifying the Default Instance for a PluginType</a>
  195
+            </li>
  196
+            <li>
  197
+              <a href="RegistryDSL.htm#section5">Specifying Additional Instances for a PluginType</a>
  198
+            </li>
  199
+            <li>
  200
+              <a href="RegistryDSL.htm#section6">Setting the Scoping/Lifecycle for a PluginType</a>
  201
+            </li>
  202
+          </ul>
  203
+        </li>
  204
+        <li>
  205
+          <a href="RegistryDSL.htm#section7">Registering a "Missing Instance"</a>
  206
+          <ul />
  207
+        </li>
  208
+        <li>
  209
+          <a href="RegistryDSL.htm#section8">Configuring Concrete Types</a>
  210
+          <ul />
  211
+        </li>
  212
+        <li>
  213
+          <a href="RegistryDSL.htm#section9">Working with Open Generic Types</a>
  214
+          <ul />
  215
+        </li>
  216
+        <li>
  217
+          <a href="RegistryDSL.htm#section10">Auto Registration and Assembly ScanningScanning</a>
  218
+          <ul />
  219
+        </li>
  220
+        <li>
  221
+          <a href="RegistryDSL.htm#section11">Setter Injection Policies</a>
  222
+          <ul />
  223
+        </li>
  224
+        <li>
  225
+          <a href="RegistryDSL.htm#section12">Interception</a>
  226
+          <ul />
  227
+        </li>
  228
+        <li>
  229
+          <a href="RegistryDSL.htm#section13">Creating a Profile</a>
  230
+          <ul />
  231
+        </li>
  232
+        <li>
  233
+          <a href="RegistryDSL.htm#section14">Using the Registry DSL Directly in Initializationlization</a>
  234
+          <ul />
  235
+        </li>
  236
+      </ul>
  237
+    </li>
  238
+    <li>
  239
+      <a href="InstanceExpression.htm">Configuring Instances</a>
  240
+      <ul>
  241
+        <li>
  242
+          <a href="InstanceExpression.htm#section0">Instance Expression</a>
  243
+          <ul>
  244
+            <li>
  245
+              <a href="InstanceExpression.htm#section1">InstanceExpression Operations</a>
  246
+            </li>
  247
+          </ul>
  248
+        </li>
  249
+        <li>
  250
+          <a href="InstanceExpression.htm#section2">Building with Constructors and Setters</a>
  251
+          <ul>
  252
+            <li>
  253
+              <a href="InstanceExpression.htm#section3">Designating the Type</a>
  254
+            </li>
  255
+            <li>
  256
+              <a href="InstanceExpression.htm#section4">Defining primitive constructor arguments</a>
  257
+            </li>
  258
+            <li>
  259
+              <a href="InstanceExpression.htm#section5">Defining primitive setter properties</a>
  260
+            </li>
  261
+            <li>
  262
+              <a href="InstanceExpression.htm#section6">Overriding Constructor Dependencies</a>
  263
+            </li>
  264
+            <li>
  265
+              <a href="InstanceExpression.htm#section7">Overriding Setter Dependencies</a>
  266
+            </li>
  267
+            <li>
  268
+              <a href="InstanceExpression.htm#section8">Array or Non Primitive Dependencies</a>
  269
+            </li>
  270
+            <li>
  271
+              <a href="InstanceExpression.htm#section9">Primitive Arrays and Dictionaries</a>
  272
+            </li>
  273
+          </ul>
  274
+        </li>
  275
+        <li>
  276
+          <a href="InstanceExpression.htm#section10">Using a Custom Instance</a>
  277
+          <ul />
  278
+        </li>
  279
+        <li>
  280
+          <a href="InstanceExpression.htm#section11">Using an Externally Constructed Object</a>
  281
+          <ul />
  282
+        </li>
  283
+        <li>
  284
+          <a href="InstanceExpression.htm#section12">Constructing Objects with Lambda Functions</a>
  285
+          <ul />
  286
+        </li>
  287
+        <li>
  288
+          <a href="InstanceExpression.htm#section13">Referencing a Named Instance</a>
  289
+          <ul />
  290
+        </li>
  291
+        <li>
  292
+          <a href="InstanceExpression.htm#section14">Using the Default Instance</a>
  293
+          <ul />
  294
+        </li>
  295
+        <li>
  296
+          <a href="InstanceExpression.htm#section15">Specifying a Prototype Object with Cloning</a>
  297
+          <ul />
  298
+        </li>
  299
+        <li>
  300
+          <a href="InstanceExpression.htm#section16">Specifying a Prototype Object with Serialization</a>
  301
+          <ul />
  302
+        </li>
  303
+        <li>
  304
+          <a href="InstanceExpression.htm#section17">Configuring Conditional Construction</a>
  305
+          <ul />
  306
+        </li>
  307
+      </ul>
  308
+    </li>
  309
+    <li>
  310
+      <a href="XmlConfiguration.htm">Xml Configuration</a>
  311
+      <ul>
  312
+        <li>
  313
+          <a href="XmlConfiguration.htm#section0">&amp;lt;StructureMap&amp;gt; Element</a>
  314
+          <ul>
  315
+            <li>
  316
+              <a href="XmlConfiguration.htm#section1">Configuring Instances</a>
  317
+            </li>
  318
+          </ul>
  319
+        </li>
  320
+        <li>
  321
+          <a href="XmlConfiguration.htm#section2">Adding a Default Instance for a PluginType</a>
  322
+          <ul />
  323
+        </li>
  324
+        <li>
  325
+          <a href="XmlConfiguration.htm#section3">Adding Additional Instances for a PluginType</a>
  326
+          <ul />
  327
+        </li>
  328
+        <li>
  329
+          <a href="XmlConfiguration.htm#section4">Defining a Profile</a>
  330
+          <ul />
  331
+        </li>
  332
+      </ul>
  333
+    </li>
  334
+    <li>
  335
+      <a href="XmlReference.htm">Xml Reference</a>
  336
+      <ul>
  337
+        <li>
  338
+          <a href="XmlReference.htm#section0">&amp;lt;StructureMap&amp;gt; Element</a>
  339
+          <ul />
  340
+        </li>
  341
+        <li>
  342
+          <a href="XmlReference.htm#section1">&amp;lt;Include&amp;gt; Element</a>
  343
+          <ul />
  344
+        </li>
  345
+        <li>
  346
+          <a href="XmlReference.htm#section2">&amp;lt;Assembly&amp;gt; Element</a>
  347
+          <ul />
  348
+        </li>
  349
+        <li>
  350
+          <a href="XmlReference.htm#section3">&amp;lt;Instances&amp;gt; Element</a>
  351
+          <ul />
  352
+        </li>
  353
+        <li>
  354
+          <a href="XmlReference.htm#section4">&amp;lt;Machine&amp;gt; Element</a>
  355
+          <ul />
  356
+        </li>
  357
+        <li>
  358
+          <a href="XmlReference.htm#section5">&amp;lt;PluginFamily&amp;gt; Element</a>
  359
+          <ul />
  360
+        </li>
  361
+        <li>
  362
+          <a href="XmlReference.htm#section6">&amp;lt;DefaultInstance&amp;gt; Element</a>
  363
+          <ul />
  364
+        </li>
  365
+        <li>
  366
+          <a href="XmlReference.htm#section7">&amp;lt;Profile&amp;gt; Element</a>
  367
+          <ul />
  368
+        </li>
  369
+        <li>
  370
+          <a href="XmlReference.htm#section8">&amp;lt;Instance&amp;gt; Element</a>
  371
+          <ul />
  372
+        </li>
  373
+        <li>
  374
+          <a href="XmlReference.htm#section9">&amp;lt;Interceptors&amp;gt; Element</a>
  375
+          <ul />
  376
+        </li>
  377
+        <li>
  378
+          <a href="XmlReference.htm#section10">&amp;lt;Interceptor&amp;gt; Element</a>
  379
+          <ul />
  380
+        </li>
  381
+        <li>
  382
+          <a href="XmlReference.htm#section11">&amp;lt;Override&amp;gt; Element</a>
  383
+          <ul />
  384
+        </li>
  385
+        <li>
  386
+          <a href="XmlReference.htm#section12">&amp;lt;Plugin&amp;gt; Element</a>
  387
+          <ul />
  388
+        </li>
  389
+        <li>
  390
+          <a href="XmlReference.htm#section13">&amp;lt;Setter&amp;gt; Element</a>
  391
+          <ul />
  392
+        </li>
  393
+        <li>
  394
+          <a href="XmlReference.htm#section14">&amp;lt;Source&amp;gt; Element</a>
  395
+          <ul />
  396
+        </li>
  397
+        <li>
  398
+          <a href="XmlReference.htm#section15">&amp;lt;Property&amp;gt; Element</a>
  399
+          <ul />
  400
+        </li>
  401
+      </ul>
  402
+    </li>
  403
+    <li>
  404
+      <a href="NodeNormalized.htm">Node Normalized Instances</a>
  405
+      <ul>
  406
+        <li>
  407
+          <a href="NodeNormalized.htm#section0">Instance Root Node</a>
  408
+          <ul />
  409
+        </li>
  410
+        <li>
  411
+          <a href="NodeNormalized.htm#section1">Primitive Properties (Strings and basic value types)</a>
  412
+          <ul />
  413
+        </li>
  414
+        <li>
  415
+          <a href="NodeNormalized.htm#section2">Long Strings</a>
  416
+          <ul />
  417
+        </li>
  418
+        <li>
  419
+          <a href="NodeNormalized.htm#section3">Enumeration Properties</a>
  420
+          <ul />
  421
+        </li>
  422
+        <li>
  423
+          <a href="NodeNormalized.htm#section4">Dependency Properties</a>
  424
+          <ul>
  425
+            <li>
  426
+              <a href="NodeNormalized.htm#section5">Inline Definition</a>
  427
+            </li>
  428
+            <li>
  429
+              <a href="NodeNormalized.htm#section6">Reference Definition</a>
  430
+            </li>
  431
+          </ul>
  432
+        </li>
  433
+      </ul>
  434
+    </li>
  435
+    <li>
  436
+      <a href="AttributeNormalized.htm">Attribute Normalized Instances</a>
  437
+      <ul>
  438
+        <li>
  439
+          <a href="AttributeNormalized.htm#section0">Instance Root Node</a>
  440
+          <ul />
  441
+        </li>
  442
+        <li>
  443
+          <a href="AttributeNormalized.htm#section1">Primitive Properties (Strings and basic value types)</a>
  444
+          <ul />
  445
+        </li>
  446
+        <li>
  447
+          <a href="AttributeNormalized.htm#section2">Long Strings</a>
  448
+          <ul />
  449
+        </li>
  450
+        <li>
  451
+          <a href="AttributeNormalized.htm#section3">Enumeration Properties</a>
  452
+          <ul />
  453
+        </li>
  454
+        <li>
  455
+          <a href="AttributeNormalized.htm#section4">Dependency Properties</a>
  456
+          <ul>
  457
+            <li>
  458
+              <a href="AttributeNormalized.htm#section5">Inline Definition</a>
  459
+            </li>
  460
+            <li>
  461
+              <a href="AttributeNormalized.htm#section6">Reference Definition</a>
  462
+            </li>
  463
+          </ul>
  464
+        </li>
  465
+        <li>
  466
+          <a href="AttributeNormalized.htm#section7">Non Primitive Array Property</a>
  467
+          <ul />
  468
+        </li>
  469
+        <li>
  470
+          <a href="AttributeNormalized.htm#section8">Primitive Arrays</a>
  471
+          <ul />
  472
+        </li>
  473
+        <li>
  474
+          <a href="AttributeNormalized.htm#section9">Dictionaries and NameValueCollection</a>
  475
+          <ul />
  476
+        </li>
  477
+      </ul>
  478
+    </li>
  479
+    <li>
  480
+      <a href="ScanningAssemblies.htm">Auto Registration and Type Scanning</a>
  481
+      <ul>
  482
+        <li>
  483
+          <a href="ScanningAssemblies.htm#section0">Using the Scan() Expression</a>
  484
+          <ul />
  485
+        </li>
  486
+        <li>
  487
+          <a href="ScanningAssemblies.htm#section1">Rules for Auto Registering a Type</a>
  488
+          <ul />
  489
+        </li>
  490
+        <li>
  491
+          <a href="ScanningAssemblies.htm#section2">Designating Assemblies </a>
  492
+          <ul />
  493
+        </li>
  494
+        <li>
  495
+          <a href="ScanningAssemblies.htm#section3">Scan all Assemblies in a Given Folder</a>
  496
+          <ul />
  497
+        </li>
  498
+        <li>
  499
+          <a href="ScanningAssemblies.htm#section4">Add All Concrete Types for a PluginType</a>
  500
+          <ul />
  501
+        </li>
  502
+        <li>
  503
+          <a href="ScanningAssemblies.htm#section5">Excluding or Including Types</a>
  504
+          <ul />
  505
+        </li>
  506
+        <li>
  507
+          <a href="ScanningAssemblies.htm#section6">Type Scanning with Attributes</a>
  508
+          <ul />
  509
+        </li>
  510
+        <li>
  511
+          <a href="ScanningAssemblies.htm#section7">Convention Based Type Registration</a>
  512
+          <ul>
  513
+            <li>
  514
+              <a href="ScanningAssemblies.htm#section8">The Default Convention</a>
  515
+            </li>
  516
+            <li>
  517
+              <a href="ScanningAssemblies.htm#section9">Registering Types by Name</a>
  518
+            </li>
  519
+            <li>
  520
+              <a href="ScanningAssemblies.htm#section10">Creating and Using Your Own Convention</a>
  521
+            </li>
  522
+          </ul>
  523
+        </li>
  524
+        <li>
  525
+          <a href="ScanningAssemblies.htm#section11">Looking for Registries</a>
  526
+          <ul />
  527
+        </li>
  528
+      </ul>
  529
+    </li>
  530
+    <li>
  531
+      <a href="Scoping.htm">Scoping, Caching, and Lifecycle Management</a>
  532
+      <ul>
  533
+        <li>
  534
+          <a href="Scoping.htm#section0">Setting the Scope in the Registry DSL</a>
  535
+          <ul />
  536
+        </li>
  537
+        <li>
  538
+          <a href="Scoping.htm#section1">Setting the Scope in the Xml Configuration</a>
  539
+          <ul />
  540
+        </li>
  541
+        <li>
  542
+          <a href="Scoping.htm#section2">Setting the Scope with the PluginFamily Attribute</a>
  543
+          <ul />
  544
+        </li>
  545
+        <li>
  546
+          <a href="Scoping.htm#section3">Using a Custom Scope/Lifecycle</a>
  547
+          <ul />
  548
+        </li>