From: <jer...@us...> - 2007-03-30 14:26:25
|
Revision: 34 http://structuremap.svn.sourceforge.net/structuremap/?rev=34&view=rev Author: jeremydmiller Date: 2007-03-30 07:26:24 -0700 (Fri, 30 Mar 2007) Log Message: ----------- last set of changes for the configuration, UserControl support Modified Paths: -------------- trunk/Source/CommonAssemblyInfo.cs trunk/Source/StructureMap/Configuration/DSL/Registry.cs trunk/Source/StructureMap/StructureMap.csproj trunk/Source/StructureMap/StructureMapConfiguration.cs trunk/Source/StructureMap/Verification/PluginGraphConsoleWriter.cs trunk/Source/StructureMap.Testing/AlternativeConfigurationTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/AddInstanceTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryTester.cs trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj trunk/Source/StructureMap.Testing/StructureMap.Testing.dll.config trunk/Source/StructureMap.Testing/StructureMapConfigurationTester.cs trunk/cruise.build Added Paths: ----------- trunk/Source/StructureMap/Configuration/DSL/UserControlExpression.cs trunk/Source/StructureMap/Configuration/StructureMapConfigurationSection.cs trunk/Source/StructureMap/Configuration/UserControlMemento.cs trunk/Source/StructureMap.Testing/Configuration/DSL/UserControlExpressionTester.cs Modified: trunk/Source/CommonAssemblyInfo.cs =================================================================== --- trunk/Source/CommonAssemblyInfo.cs 2007-03-29 18:31:00 UTC (rev 33) +++ trunk/Source/CommonAssemblyInfo.cs 2007-03-30 14:26:24 UTC (rev 34) @@ -14,7 +14,7 @@ [assembly: ComVisibleAttribute(false)] [assembly: AssemblyVersionAttribute("1.0.0.0000")] -[assembly: AssemblyCopyrightAttribute("Copyright (c) 2005, Jeremy D. Miller, Jeffrey Palermo")] +[assembly: AssemblyCopyrightAttribute("Copyright (c) 2007, Jeremy D. Miller")] [assembly: AssemblyProductAttribute("StructureMap")] [assembly: AssemblyCompanyAttribute("")] [assembly: AssemblyConfigurationAttribute("release")] Modified: trunk/Source/StructureMap/Configuration/DSL/Registry.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Registry.cs 2007-03-29 18:31:00 UTC (rev 33) +++ trunk/Source/StructureMap/Configuration/DSL/Registry.cs 2007-03-30 14:26:24 UTC (rev 34) @@ -103,6 +103,11 @@ return expression; } + public static UserControlExpression LoadUserControlFrom<T>(string url) + { + return new UserControlExpression(typeof(T), url); + } + public ProfileExpression CreateProfile(string profileName) { ProfileExpression expression = new ProfileExpression(profileName); @@ -125,5 +130,13 @@ return (type.GetConstructor(new Type[0]) != null); } + + public UserControlExpression LoadControlFromUrl<T>(string url) + { + UserControlExpression expression = new UserControlExpression(typeof(T), url); + addExpression(expression); + + return expression; + } } } \ No newline at end of file Added: trunk/Source/StructureMap/Configuration/DSL/UserControlExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/UserControlExpression.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/DSL/UserControlExpression.cs 2007-03-30 14:26:24 UTC (rev 34) @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Text; +using StructureMap.Graph; + +namespace StructureMap.Configuration.DSL +{ + public class UserControlExpression : MementoBuilder<UserControlExpression> + { + private UserControlMemento _memento; + + public UserControlExpression(Type pluginType, string url) : base(pluginType) + { + _memento.Url = url; + } + + protected override InstanceMemento memento + { + get { return _memento; } + } + + protected override UserControlExpression thisInstance + { + get { return this; } + } + + protected override void configureMemento(PluginFamily family) + { + // no-op + } + + protected override void validate() + { + // no-op + } + + protected override void buildMemento() + { + _memento = new UserControlMemento(); + } + + public override void ValidatePluggability(Type pluginType) + { + // no-op + } + } +} Added: trunk/Source/StructureMap/Configuration/StructureMapConfigurationSection.cs =================================================================== --- trunk/Source/StructureMap/Configuration/StructureMapConfigurationSection.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/StructureMapConfigurationSection.cs 2007-03-30 14:26:24 UTC (rev 34) @@ -0,0 +1,35 @@ + + +using System.Configuration; +using System.Diagnostics; +using System.Xml; + +namespace StructureMap.Configuration +{ + public class StructureMapConfigurationSection : IConfigurationSectionHandler + { + private XmlNode _node; + + public object Create(object parent, object configContext, XmlNode section) + { + return _node; + } + + public static XmlNode GetStructureMapConfiguration() + { + object config = ConfigurationManager.GetSection(XmlConstants.STRUCTUREMAP); + + + return null; + /* + object o = ConfigurationSettings.GetConfig(XmlConstants.STRUCTUREMAP); + XmlNode node = o as XmlNode; + if (node == null) + { + throw new ApplicationException("No <StructureMap> section was found in the application config file"); + } + return node; + */ + } + } +} Added: trunk/Source/StructureMap/Configuration/UserControlMemento.cs =================================================================== --- trunk/Source/StructureMap/Configuration/UserControlMemento.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/UserControlMemento.cs 2007-03-30 14:26:24 UTC (rev 34) @@ -0,0 +1,68 @@ +using System; +using System.Web.UI; + +namespace StructureMap.Configuration +{ + public class UserControlMemento : InstanceMemento + { + private string _instanceKey; + private string _url; + + public UserControlMemento(string instanceKey, string url) + { + _instanceKey = instanceKey; + _url = url; + } + + + public UserControlMemento() + { + } + + public string Url + { + get { return _url; } + set { _url = value; } + } + + public override object Build(IInstanceCreator creator) + { + return new Page().LoadControl(_url); + } + + protected override string innerConcreteKey + { + get { return string.Empty; } + } + + protected override string innerInstanceKey + { + get { return _instanceKey; } + } + + protected override string getPropertyValue(string Key) + { + throw new NotImplementedException(); + } + + protected override InstanceMemento getChild(string Key) + { + throw new NotImplementedException(); + } + + public override InstanceMemento[] GetChildrenArray(string Key) + { + throw new NotImplementedException(); + } + + public override bool IsReference + { + get { return false; } + } + + public override string ReferenceKey + { + get { throw new NotImplementedException(); } + } + } +} Modified: trunk/Source/StructureMap/StructureMap.csproj =================================================================== --- trunk/Source/StructureMap/StructureMap.csproj 2007-03-29 18:31:00 UTC (rev 33) +++ trunk/Source/StructureMap/StructureMap.csproj 2007-03-30 14:26:24 UTC (rev 34) @@ -229,6 +229,7 @@ <Compile Include="Configuration\DSL\PrototypeMemento.cs" /> <Compile Include="Configuration\DSL\Registry.cs" /> <Compile Include="Configuration\DSL\ScanAssembliesExpression.cs" /> + <Compile Include="Configuration\DSL\UserControlExpression.cs" /> <Compile Include="Configuration\FamilyParser.cs"> <SubType>Code</SubType> </Compile> @@ -263,6 +264,7 @@ <SubType>Code</SubType> </Compile> <Compile Include="Configuration\ProfileAndMachineParser.cs" /> + <Compile Include="Configuration\StructureMapConfigurationSection.cs" /> <Compile Include="Configuration\Tokens\AssemblyToken.cs"> <SubType>Code</SubType> </Compile> @@ -329,6 +331,7 @@ <Compile Include="Configuration\Tokens\TemplateToken.cs"> <SubType>Code</SubType> </Compile> + <Compile Include="Configuration\UserControlMemento.cs" /> <Compile Include="Configuration\XmlConstants.cs"> <SubType>Code</SubType> </Compile> Modified: trunk/Source/StructureMap/StructureMapConfiguration.cs =================================================================== --- trunk/Source/StructureMap/StructureMapConfiguration.cs 2007-03-29 18:31:00 UTC (rev 33) +++ trunk/Source/StructureMap/StructureMapConfiguration.cs 2007-03-30 14:26:24 UTC (rev 34) @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Configuration; using System.IO; using System.Xml; using StructureMap.Configuration; @@ -16,6 +17,7 @@ private static Registry _registry = new Registry(); private static List<Registry> _registries = new List<Registry>(); private static StartUp _startUp; + private static bool _pullConfigurationFromAppConfig; static StructureMapConfiguration() { @@ -69,6 +71,15 @@ private static PluginGraphBuilder createBuilder() { + if (_pullConfigurationFromAppConfig) + { + _collection.IncludeNode(delegate() + { + + return StructureMapConfigurationSection.GetStructureMapConfiguration(); + }); + } + ConfigurationParser[] parsers = _collection.GetParsers(); return new PluginGraphBuilder(parsers, _registries.ToArray()); } @@ -102,6 +113,17 @@ set { _collection.UseDefaultFile = value; } } + [Obsolete("Not ready yet")] + public static bool PullConfigurationFromAppConfig + { + get { return _pullConfigurationFromAppConfig; } + set + { + throw new NotImplementedException("This feature has not been completed"); + _pullConfigurationFromAppConfig = value; + } + } + public static ScanAssembliesExpression ScanAssemblies() { ScanAssembliesExpression expression = new ScanAssembliesExpression(); Modified: trunk/Source/StructureMap/Verification/PluginGraphConsoleWriter.cs =================================================================== --- trunk/Source/StructureMap/Verification/PluginGraphConsoleWriter.cs 2007-03-29 18:31:00 UTC (rev 33) +++ trunk/Source/StructureMap/Verification/PluginGraphConsoleWriter.cs 2007-03-30 14:26:24 UTC (rev 34) @@ -140,6 +140,7 @@ { _writer.WriteLine(problem.Path); _writer.WriteLine(problem.ToString()); + writeSeparator(); } } Modified: trunk/Source/StructureMap.Testing/AlternativeConfigurationTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/AlternativeConfigurationTester.cs 2007-03-29 18:31:00 UTC (rev 33) +++ trunk/Source/StructureMap.Testing/AlternativeConfigurationTester.cs 2007-03-30 14:26:24 UTC (rev 34) @@ -15,6 +15,7 @@ StructureMapConfiguration.ResetAll(); DataMother.WriteDocument("Config1.xml"); DataMother.WriteDocument("Config2.xml"); + DataMother.WriteDocument("FullTesting.XML"); } [TearDown] Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/AddInstanceTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DSL/AddInstanceTester.cs 2007-03-29 18:31:00 UTC (rev 33) +++ trunk/Source/StructureMap.Testing/Configuration/DSL/AddInstanceTester.cs 2007-03-30 14:26:24 UTC (rev 34) @@ -142,7 +142,7 @@ Assert.AreEqual("Purple", widget.Color); } - [Test] + [Test, Explicit] public void CreateAnInstancePullAPropertyFromTheApplicationConfig() { Assert.AreEqual("Blue", ConfigurationManager.AppSettings["Color"]); Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryTester.cs 2007-03-29 18:31:00 UTC (rev 33) +++ trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryTester.cs 2007-03-30 14:26:24 UTC (rev 34) @@ -1,6 +1,7 @@ using System; using NUnit.Framework; using Rhino.Mocks; +using StructureMap.Configuration; using StructureMap.Configuration.DSL; using StructureMap.Graph; using StructureMap.Testing.Widget3; @@ -64,6 +65,26 @@ mocks.VerifyAll(); } + + [Test] + public void LoadControl() + { + PluginGraph graph = new PluginGraph(); + Registry registry = new Registry(graph); + + string theUrl = "some url"; + string theKey = "the memento"; + registry.LoadControlFromUrl<IGateway>(theUrl).WithName(theKey); + + registry.Dispose(); + + PluginFamily family = graph.PluginFamilies[typeof (IGateway)]; + UserControlMemento memento = (UserControlMemento) family.Source.GetMemento(theKey); + Assert.IsNotNull(memento); + + Assert.AreEqual(theUrl, memento.Url); + Assert.AreEqual(theKey, memento.InstanceKey); + } } public class TestRegistry : Registry Added: trunk/Source/StructureMap.Testing/Configuration/DSL/UserControlExpressionTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DSL/UserControlExpressionTester.cs (rev 0) +++ trunk/Source/StructureMap.Testing/Configuration/DSL/UserControlExpressionTester.cs 2007-03-30 14:26:24 UTC (rev 34) @@ -0,0 +1,53 @@ +using NUnit.Framework; +using Rhino.Mocks; +using StructureMap.Configuration; +using StructureMap.Configuration.DSL; +using StructureMap.Graph; + +namespace StructureMap.Testing.Configuration.DSL +{ + [TestFixture] + public class UserControlExpressionTester + { + [SetUp] + public void SetUp() + { + } + + [Test] + public void CreateMementoHappyPath() + { + string theUrl = "alskdjf"; + + UserControlExpression expression = new UserControlExpression(typeof(IControl), theUrl); + + UserControlMemento memento = (UserControlMemento) ((IMementoBuilder) expression).BuildMemento(new PluginGraph()); + Assert.IsNotNull(memento); + + Assert.AreEqual(theUrl, memento.Url); + Assert.IsNotEmpty(memento.InstanceKey); + Assert.IsNotNull(memento.InstanceKey); + } + + [Test] + public void CreateMementoHappyPathWithName() + { + string theUrl = "alskdjf"; + string theName = "the name"; + + UserControlExpression expression = new UserControlExpression(typeof(IControl), theUrl); + expression.WithName(theName); + + UserControlMemento memento = (UserControlMemento)((IMementoBuilder)expression).BuildMemento(new PluginGraph()); + Assert.IsNotNull(memento); + + Assert.AreEqual(theUrl, memento.Url); + Assert.AreEqual(theName, memento.InstanceKey); + } + } + + public interface IControl + { + + } +} Modified: trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj =================================================================== --- trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj 2007-03-29 18:31:00 UTC (rev 33) +++ trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj 2007-03-30 14:26:24 UTC (rev 34) @@ -195,6 +195,7 @@ <Compile Include="Configuration\DSL\RegistryIntegratedTester.cs" /> <Compile Include="Configuration\DSL\RegistryTester.cs" /> <Compile Include="Configuration\DSL\ScanAssembliesTester.cs" /> + <Compile Include="Configuration\DSL\UserControlExpressionTester.cs" /> <Compile Include="Configuration\FamilyParserTester.cs"> <SubType>Code</SubType> </Compile> Modified: trunk/Source/StructureMap.Testing/StructureMap.Testing.dll.config =================================================================== --- trunk/Source/StructureMap.Testing/StructureMap.Testing.dll.config 2007-03-29 18:31:00 UTC (rev 33) +++ trunk/Source/StructureMap.Testing/StructureMap.Testing.dll.config 2007-03-30 14:26:24 UTC (rev 34) @@ -1,7 +1,37 @@ <?xml version="1.0" encoding="utf-8" ?> <configuration> + <configSections> + <section name="StructureMap" type="StructureMap.Configuration.StructureMapConfigurationSection,StructureMap"/> + </configSections> + + <StructureMap> + <Assembly Name="StructureMap.Testing.GenericWidgets"/> + + <PluginFamily Assembly="StructureMap.Testing.GenericWidgets" Type="StructureMap.Testing.GenericWidgets.IThing`2" DefaultKey="Cornflower"> + <Plugin Assembly="StructureMap.Testing.GenericWidgets" Type="StructureMap.Testing.GenericWidgets.ColorThing`2" ConcreteKey="Color" /> + <Plugin Assembly="StructureMap.Testing.GenericWidgets" Type="StructureMap.Testing.GenericWidgets.ComplexThing`2" ConcreteKey="Complex" /> + + <Instance Key="Cornflower" Type="Color"> + <Property Name="color" Value="Cornflower"/> + </Instance> + + <Instance Key="Complicated" Type="Complex"> + <Property Name="name" Value="Jeremy" /> + <Property Name="age" Value="32" /> + <Property Name="ready" Value="true" /> + </Instance> + </PluginFamily> + + <PluginFamily Assembly="StructureMap.Testing.GenericWidgets" Type="StructureMap.Testing.GenericWidgets.ISimpleThing`1" DefaultKey="Simple"> + <Plugin Assembly="StructureMap.Testing.GenericWidgets" Type="StructureMap.Testing.GenericWidgets.SimpleThing`1" ConcreteKey="Simple" /> + </PluginFamily> + </StructureMap> + + <appSettings> <add key="Color" value="Blue"/> <add key="Day" value="Monday"/> </appSettings> + + </configuration> \ No newline at end of file Modified: trunk/Source/StructureMap.Testing/StructureMapConfigurationTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/StructureMapConfigurationTester.cs 2007-03-29 18:31:00 UTC (rev 33) +++ trunk/Source/StructureMap.Testing/StructureMapConfigurationTester.cs 2007-03-30 14:26:24 UTC (rev 34) @@ -3,6 +3,7 @@ using NUnit.Framework; using StructureMap.Configuration; using StructureMap.Graph; +using StructureMap.Testing.GenericWidgets; namespace StructureMap.Testing { @@ -72,6 +73,19 @@ Assert.IsTrue(File.Exists(filePath)); } + + + [Test, Ignore("Not complete")] + public void PullConfigurationFromTheAppConfig() + { + StructureMapConfiguration.UseDefaultStructureMapConfigFile = false; + StructureMapConfiguration.PullConfigurationFromAppConfig = true; + + ColorThing<string, bool> thing = (ColorThing<string, bool>) ObjectFactory.GetInstance < IThing<string, bool>>(); + Assert.AreEqual("Cornflower", thing.Color, "Cornflower is the color from the App.config file"); + } + + } public interface ISomething Modified: trunk/cruise.build =================================================================== --- trunk/cruise.build 2007-03-29 18:31:00 UTC (rev 33) +++ trunk/cruise.build 2007-03-30 14:26:24 UTC (rev 34) @@ -48,7 +48,7 @@ <attributes> <attribute type="ComVisibleAttribute" value="false" /> <attribute type="AssemblyVersionAttribute" value="${assembly-version}" /> - <attribute type="AssemblyCopyrightAttribute" value="Copyright (c) 2005, Jeremy D. Miller, Jeffrey Palermo" /> + <attribute type="AssemblyCopyrightAttribute" value="Copyright (c) 2007, Jeremy D. Miller" /> <attribute type="AssemblyProductAttribute" value="StructureMap" /> <attribute type="AssemblyCompanyAttribute" value="" /> <attribute type="AssemblyConfigurationAttribute" value="${project.config}" /> @@ -118,14 +118,16 @@ </target> <target name="unit-test"> - <nunit2 failonerror="true"> - <formatter type="Xml" outputdir="${results.dir}" usefile="true" extension=".xml"/> - <formatter type="Plain" /> - - <test assemblyname="${build.dir}\StructureMap.Testing.dll" appconfig="${nant.location}nant.tests.config" /> - <test assemblyname="${build.dir}\StructureMap.Testing.DeploymentTasks.dll" appconfig="${nant.location}nant.tests.config" /> - </nunit2> + <property name="nunit-console.exe" value="bin\NUnit\nunit-console.exe" /> + <exec program="${nunit-console.exe}" workingdir="${build.dir}"> + <arg value="StructureMap.Testing.dll" /> + </exec> +<!-- + <exec program="${nunit-console.exe}" workingdir="${build.dir}"> + <arg value="StructureMap.Testing.DeploymentTasks.dll" /> + </exec> +--> </target> <target name="runDoctor"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2007-04-01 22:21:18
|
Revision: 36 http://structuremap.svn.sourceforge.net/structuremap/?rev=36&view=rev Author: jeremydmiller Date: 2007-04-01 15:21:15 -0700 (Sun, 01 Apr 2007) Log Message: ----------- Added the <DefaultInstance> node capability, documentation, set the default profile from code Modified Paths: -------------- trunk/Docs/Configuration.htm trunk/Docs/Default.htm trunk/Source/StructureMap/Configuration/ConfigurationParser.cs trunk/Source/StructureMap/Configuration/FamilyParser.cs trunk/Source/StructureMap/Configuration/GraphObject.cs trunk/Source/StructureMap/Configuration/PluginGraphReport.cs trunk/Source/StructureMap/Configuration/StructureMapConfigurationSection.cs trunk/Source/StructureMap/Configuration/UserControlMemento.cs trunk/Source/StructureMap/Configuration/XmlConstants.cs trunk/Source/StructureMap/Graph/PluginGraph.cs trunk/Source/StructureMap/InstanceMemento.cs trunk/Source/StructureMap/Source/XmlNodeInstanceMemento.cs trunk/Source/StructureMap/Verification/StartUp.cs trunk/Source/StructureMap.Testing/Configuration/DSL/UserControlExpressionTester.cs trunk/Source/StructureMap.Testing/Configuration/FamilyParserTester.cs trunk/Source/StructureMap.Testing/GenericsAcceptanceTester.cs trunk/Source/StructureMap.Testing/ObjectMother.cs trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj trunk/Source/StructureMap.Testing/StructureMapConfigurationTester.cs trunk/Source/StructureMap.Testing/TestData/DataMother.cs trunk/Source/StructureMap.Testing.Widget/IWidget.cs trunk/Source/StructureMap.Testing.Widget/Rule.cs Added Paths: ----------- trunk/Source/StructureMap.Testing/Configuration/DefaultInstanceNodeTester.cs trunk/Source/StructureMap.Testing/TestData/DefaultInstance.xml Modified: trunk/Docs/Configuration.htm =================================================================== --- trunk/Docs/Configuration.htm 2007-04-01 18:18:16 UTC (rev 35) +++ trunk/Docs/Configuration.htm 2007-04-01 22:21:15 UTC (rev 36) @@ -54,6 +54,7 @@ <A href="#log4net">log4net</A><BR> <A href="#Machine">Machine</A><BR> <A href="#PluginFamily">PluginFamily</A><BR> + <A href="#DefaultInstance">DefaultInstance</A><BR> <A href="#Profile">Profile</A><BR> <A href="#Instance">Instance</A><BR> <A href="#Interceptors">Interceptors</A><BR> @@ -63,6 +64,7 @@ <A href="#Setter">Setter</A><BR> <A href="#Source">Source</A><BR> <A href="#Property">Property</A></P> + <HR width="100%" SIZE="1"> <!--StructureMap node--> <A name="StructureMap"></A> @@ -81,6 +83,10 @@ <TD>Directs StructureMap to use the named Profile as the default profile at runtime</TD> </TR> + <tr> + <td>MementoStyle</td> + <td>Specifies the type of Instance Memento definition between "Node" normalized and "Attribute" normalized. For backwards compatibility, the default value is "Node"</td> + </tr> </TABLE> </DIV> <p><A href="#TopOfPage">Back to Top</A><BR> @@ -175,11 +181,19 @@ <HR> <A name="Machine"></A> <H3><Machine> Element</H3> - <P>Machine level overrides for default instances of one or more PluginFamily\x92s</P> + <P>Machine level overrides for default instances of one or more PluginFamily\x92s. New in version 2.0 is the ability to define the instance for the type specified by the Type attribute inline in an embedded <Instance> node</P> <H4>Sample</H4> - <pre class="xml-sample"><Machine Name="SERVER" Profile="Local"> + <pre class="xml-sample"> +<Machine Name="SERVER" Profile="Local"> <Override Type="StructureMap.Testing.Widget.IWidget" DefaultKey="Orange"/> -</Machine></pre> +</Machine> + + <Override Type="StructureMap.Testing.Widget.Rule"> + <Instance Type="Color" Color="Green"/> + </Override> + + +</pre> <H4>Required Attributes</H4> <DIV class="schema-table"><TABLE width="100%" border="1" cellPadding="1" cellSpacing="1" ID="Table3"> <TR> @@ -253,6 +267,62 @@ <A href="#TopOfPage">Back to Top</A><BR> <BR> <HR> + + + + + <A name="DefaultInstance"></A> + <H3><DefaultInstance> Element</H3> + <P>Shorthand way to explicitly define the default instance of a PluginType in one element. Explicitly directs and + configures StructureMap to create instances of the CLR Type specified by the "PluginType" attribute. The DefaultInstance node also represents an Instance node, and the arguments to the constructor function and setter properties follow the same rules as an Instance node.</P> + <H4>Sample</H4> + <pre class="xml-sample"><DefaultInstance PluginType="StructureMap.Testing.Widget.Rule,StructureMap.Testing" PluggedType="StructureMap.Testing.Widget.ColorRule,StructureMap.Testing" Scope="Singleton"> Color="Red" + <BR> </DefaultInstance></pre> + <H4>Required Attributes</H4> + <DIV class="schema-table"><TABLE width="100%" border="1" cellPadding="1" cellSpacing="1" ID="Table19"> + <TR> + <TH width="25%"> + Attribute</TH><TH width="75%">Description</TH></TR> + <TR> + <TD>PluginType</TD> + <TD>Assembly qualified name of the PluginType, as in PluginType instance = ObjectFactory.GetInstance<PluginType>()</TD> + </TR> + <TR> + <TD>PluggedType</TD> + <TD>The assembly qualified name of the concrete type</TD> + </TR> + </TABLE> + </DIV> + <H4>Optional Attributes</H4> + <DIV class="schema-table"><TABLE width="100%" border="1" cellPadding="1" cellSpacing="1" ID="Table20"> + <TR> + <TH width="25%"> + Attribute</TH><TH width="75%">Description</TH></TR> + <TR> + <TD>Name</TD> + <TD>The InstanceKey of the default instance. If unspecified, StructureMap will create a default name. This is mostly for diagnostics.</TD> + </TR> + <TR> + <TD>Scope</TD> + <TD>Controls the "scope" of the requested + instance. The default value is + PerRequest. Valid values are + PerRequest, Singleton, ThreadLocal, + HttpContext, and Hybrid (uses HttpContext if + available, otherwise ThreadLocal)</TD> + </TR> + </TABLE> + </DIV> + <BR> + <A href="#TopOfPage">Back to Top</A><BR> + <BR> + <HR> + + + + + + <A name="Profile"></A> <H3><Profile> Element</H3> <P>Models a named set of overrides for default instances of one or more @@ -261,7 +331,14 @@ <pre class="xml-sample"><Profile Name="Blue"> <Override Type="StructureMap.Testing.Widget.Rule" DefaultKey="Blue"/> <Override Type="StructureMap.Testing.Widget.IWidget" DefaultKey="Blue"/> -</Profile></pre> +</Profile> + +<Override Type="StructureMap.Testing.Widget.Rule"> + <Instance Type="Color" Color="Green"/> +</Override> + + +</pre> <H4>Required Attributes</H4> <DIV class="schema-table"><TABLE width="100%" border="1" cellPadding="1" cellSpacing="1" ID="Table7"> <TR> @@ -285,7 +362,16 @@ <Property Name="Attribute" Value="MyDad" /> <Property Name="Value" Value="10" /> </Instance><BR> -</PluginFamily></pre> +</PluginFamily> + +* OR * + +<PluginFamily><BR> <Instance Key="Bigger" PluggedType="Assembly Qualified Name"> + <Property Name="Attribute" Value="MyDad" /> + <Property Name="Value" Value="10" /> + </Instance><BR> +</PluginFamily> +</pre> <H4>Required Attributes</H4> <DIV class="schema-table"><TABLE width="100%" border="1" cellPadding="1" cellSpacing="1" ID="Table8"> <TR> @@ -308,6 +394,10 @@ <TR> <TH width="25%"> Attribute</TH><TH width="75%">Description</TH></TR> + <tr> + <td>PluggedType</td> + <td>An alternative to the Type attribute. Allows you to specify the assembly qualified type of the concrete class directly</td> + </tr> <TR> <TD>Template</TD> <TD>When using the Modified: trunk/Docs/Default.htm =================================================================== --- trunk/Docs/Default.htm 2007-04-01 18:18:16 UTC (rev 35) +++ trunk/Docs/Default.htm 2007-04-01 22:21:15 UTC (rev 36) @@ -15,7 +15,7 @@ border="0" alt="SourceForge.net Logo"></A> </p> <P style="LINE-HEIGHT: 25px"> - <A href="default.htm">Home</A><BR> + <A href="Default.htm">Home</A><BR> <a href="http://sourceforge.net/projects/structuremap">StructureMap on SourceForge</a><br> <A href="Basic Architecture.htm">Basic Architecture</A><BR> <A href="Concepts.htm">Concepts</A><BR> @@ -53,10 +53,26 @@ generic flexibility mechanisms. Used judiciously, StructureMap can greatly enhance the opportunities for code reuse by minimizing direct coupling between classes and configuration mechanisms.</p> + <p> + StructureMap is released under the permissive Apache 2 OSS license. You are + free to download, modify, or redistribute StructureMap in any way you see fit.</p> <p> - New in version 1.0 is the ability to create - self-diagnostic deployment configurations</p> - <p>Consider using StructureMap if you\x85</p> + New for version 2.0</p> + <ul> + <li>Full support for pluggable generic types. IService<T> and Service<T>. + Auto wiring support for generic arguments</li> + <li>Simpler, more terse Xml configuration. Fewer steps and less Xml.</li> + <li>Define Profile instances inline for less Xml</li> + <li>New Fluent Interface API for programmatic configuration. If so desired, all configuration can now be done in code at application startup</li> + <li>The default StructureMap.config file is now optional</li> + <li>Use multiple configuration files additively for easier configuration of composite + applications</li> + <li>Pluggable ASP.Net UserControl's</li> + <li>Inject prototype instances</li> + <li>Inject prebuilt singleton instances </li> + </ul> + <p> + Consider using StructureMap if you\x85</p> <ul> <li> Require significant extensibility @@ -72,44 +88,14 @@ <p>Do not use StructureMap if an application or process requires little flexibility. The abstraction and indirection afforded by StructureMap is unnecessary and even harmful in simpler systems or processes. </p> - <p>New for version 1.0</p> - <ul> - <li>New terser <a href="AttributeNormalized.htm"> - Attribute Normalized Xml</a> configuration style</li> - <li>The ability to <a href="Configuration.htm#Include"> - include secondary configuration files</a></li> - <li>Set a default profile at the top level of - configuration</li> - <li><a href="StructureMapDoctor.htm"> - StructureMapExplorer</a>, a WinForms tool to explore and - debug StructureMap configurations</li> - <li>New <a href="NAnt%20Tasks.htm">ancillary NAnt tasks</a>, - including functionality to create a file "manifest" to - verify the contents of an application deployment</li> - <li>New <a href="MementoSources.htm">configuration - storage choices</a></li> - <li>New Instance <a href="Scoping.htm">lifecycle scoping - </a>options</li> - <li>The "<a href="MementoSources.htm">TemplatedMementoSource</a>" - option for large instance graphs</li> - <li>Streamlined codebase with less coupling and greater - test coverage. Greatly improved diagnostics.</li> - <li>New methods on ObjectFactory<ul> - <li>GetAllInstances() - returns all instances of a - certain type</li> - <li>WhatDoIHave() - for runtime troubleshooting</li> - <li>GetInstance(Type, InstanceMemento)</li> - </ul> - </li> - </ul> <h3>Status</h3> - <p>StructureMap has been in multiple production systems + <p>StructureMap is the oldest IoC/DI tool for .Net development and has been used in multiple production systems since - June 2004. The current version 1.0 was released in - May 2006. StructureMap is maintained and developed by + June 2004. The current version 2.0 was released in April 2007. StructureMap is maintained and developed by <a href="mailto:jer...@ya...?subject=StructureMap">Jeremy D. Miller</a>, <a href="http://codebetter.com/blogs/jeremy.miller">The - Shade Tree Developer</a></p> + Shade Tree Developer</a>. + </p> <p>Recent Articles</p> <ul> <li> @@ -123,9 +109,9 @@ </ul> <h3>Feature List</h3> <UL> - <LI> + <li> Creates objects using the <a href="http://picocontainer.codehaus.org/Constructor+Injection"> - Constructor Injection pattern</a> + Constructor Injection pattern</a> </li> <LI> Optionally, attach dependencies and other properties through Setter Injection (v0.90) Modified: trunk/Source/StructureMap/Configuration/ConfigurationParser.cs =================================================================== --- trunk/Source/StructureMap/Configuration/ConfigurationParser.cs 2007-04-01 18:18:16 UTC (rev 35) +++ trunk/Source/StructureMap/Configuration/ConfigurationParser.cs 2007-04-01 22:21:15 UTC (rev 36) @@ -133,10 +133,6 @@ parseAssemblies(builder); } - public void ParseFamilies(IGraphBuilder builder) - { - parseFamilies(builder); - } public void ParseInstances(IGraphBuilder builder) { @@ -168,14 +164,21 @@ } - private void parseFamilies(IGraphBuilder builder) + public void ParseFamilies(IGraphBuilder builder) { - FamilyParser familyParser = new FamilyParser(builder); + FamilyParser familyParser = new FamilyParser(builder, _mementoCreator); + XmlNodeList familyNodes = findNodes(XmlConstants.PLUGIN_FAMILY_NODE); foreach (XmlElement familyElement in familyNodes) { familyParser.ParseFamily(familyElement); } + + XmlNodeList defaultNodes = findNodes(XmlConstants.DEFAULT_INSTANCE); + foreach (XmlElement element in defaultNodes) + { + familyParser.ParseDefaultElement(element); + } } Modified: trunk/Source/StructureMap/Configuration/FamilyParser.cs =================================================================== --- trunk/Source/StructureMap/Configuration/FamilyParser.cs 2007-04-01 18:18:16 UTC (rev 35) +++ trunk/Source/StructureMap/Configuration/FamilyParser.cs 2007-04-01 22:21:15 UTC (rev 36) @@ -10,10 +10,12 @@ public class FamilyParser { private readonly IGraphBuilder _builder; + private readonly XmlMementoCreator _mementoCreator; - public FamilyParser(IGraphBuilder builder) + public FamilyParser(IGraphBuilder builder, XmlMementoCreator mementoCreator) { _builder = builder; + _mementoCreator = mementoCreator; } public void ParseFamily(XmlElement familyElement) @@ -32,6 +34,23 @@ attachInterceptors(typePath, familyElement); } + public void ParseDefaultElement(XmlElement element) + { + TypePath pluginTypePath = TypePath.GetTypePath(element.GetAttribute(XmlConstants.PLUGIN_TYPE)); + InstanceScope scope = findScope(element); + string name = element.GetAttribute(XmlConstants.NAME); + if (string.IsNullOrEmpty(name)) + { + name = "DefaultInstanceOf" + pluginTypePath.AssemblyQualifiedName; + } + + InstanceMemento memento = _mementoCreator.CreateMemento(element); + memento.InstanceKey = name; + + _builder.AddPluginFamily(pluginTypePath, name, new string[0], scope); + _builder.RegisterMemento(pluginTypePath, memento); + } + private InstanceScope findScope(XmlElement familyElement) { InstanceScope returnValue = InstanceScope.PerRequest; @@ -87,5 +106,7 @@ _builder.AddInterceptor(pluginTypePath, interceptorMemento); } } + + } } \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/GraphObject.cs =================================================================== --- trunk/Source/StructureMap/Configuration/GraphObject.cs 2007-04-01 18:18:16 UTC (rev 35) +++ trunk/Source/StructureMap/Configuration/GraphObject.cs 2007-04-01 22:21:15 UTC (rev 36) @@ -1,5 +1,4 @@ using System; -using System.Collections; using System.Collections.Generic; namespace StructureMap.Configuration Modified: trunk/Source/StructureMap/Configuration/PluginGraphReport.cs =================================================================== --- trunk/Source/StructureMap/Configuration/PluginGraphReport.cs 2007-04-01 18:18:16 UTC (rev 35) +++ trunk/Source/StructureMap/Configuration/PluginGraphReport.cs 2007-04-01 22:21:15 UTC (rev 36) @@ -89,7 +89,6 @@ FamilyToken[] returnValue = new FamilyToken[_families.Count]; _families.Values.CopyTo(returnValue, 0); - return returnValue; } Modified: trunk/Source/StructureMap/Configuration/StructureMapConfigurationSection.cs =================================================================== --- trunk/Source/StructureMap/Configuration/StructureMapConfigurationSection.cs 2007-04-01 18:18:16 UTC (rev 35) +++ trunk/Source/StructureMap/Configuration/StructureMapConfigurationSection.cs 2007-04-01 22:21:15 UTC (rev 36) @@ -1,7 +1,4 @@ - - using System.Configuration; -using System.Diagnostics; using System.Xml; namespace StructureMap.Configuration @@ -18,8 +15,8 @@ public static XmlNode GetStructureMapConfiguration() { object config = ConfigurationManager.GetSection(XmlConstants.STRUCTUREMAP); - + return null; /* object o = ConfigurationSettings.GetConfig(XmlConstants.STRUCTUREMAP); @@ -32,4 +29,4 @@ */ } } -} +} \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/UserControlMemento.cs =================================================================== --- trunk/Source/StructureMap/Configuration/UserControlMemento.cs 2007-04-01 18:18:16 UTC (rev 35) +++ trunk/Source/StructureMap/Configuration/UserControlMemento.cs 2007-04-01 22:21:15 UTC (rev 36) @@ -65,4 +65,4 @@ get { throw new NotImplementedException(); } } } -} +} \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/XmlConstants.cs =================================================================== --- trunk/Source/StructureMap/Configuration/XmlConstants.cs 2007-04-01 18:18:16 UTC (rev 35) +++ trunk/Source/StructureMap/Configuration/XmlConstants.cs 2007-04-01 22:21:15 UTC (rev 36) @@ -30,6 +30,8 @@ public const string NODE_STYLE = "Node"; public const string ATTRIBUTE_STYLE = "Attribute"; public const string PLUGGED_TYPE = "PluggedType"; + public const string PLUGIN_TYPE = "PluginType"; + public const string DEFAULT_INSTANCE = "DefaultInstance"; private XmlConstants() Modified: trunk/Source/StructureMap/Graph/PluginGraph.cs =================================================================== --- trunk/Source/StructureMap/Graph/PluginGraph.cs 2007-04-01 18:18:16 UTC (rev 35) +++ trunk/Source/StructureMap/Graph/PluginGraph.cs 2007-04-01 22:21:15 UTC (rev 36) @@ -2,7 +2,6 @@ using System.Collections; using System.Collections.Generic; using System.Reflection; -using StructureMap.Configuration; using StructureMap.Configuration.DSL; namespace StructureMap.Graph Modified: trunk/Source/StructureMap/InstanceMemento.cs =================================================================== --- trunk/Source/StructureMap/InstanceMemento.cs 2007-04-01 18:18:16 UTC (rev 35) +++ trunk/Source/StructureMap/InstanceMemento.cs 2007-04-01 22:21:15 UTC (rev 36) @@ -254,7 +254,7 @@ public Plugin CreateInferredPlugin() { - string pluggedTypeName = getPropertyValue(XmlConstants.PLUGGED_TYPE); + string pluggedTypeName = getPluggedType(); if (string.IsNullOrEmpty(pluggedTypeName)) { return null; @@ -266,6 +266,11 @@ } } + protected virtual string getPluggedType() + { + return this.getPropertyValue(XmlConstants.PLUGGED_TYPE); + } + public virtual object Build(IInstanceCreator creator) { return creator.BuildInstance(this); Modified: trunk/Source/StructureMap/Source/XmlNodeInstanceMemento.cs =================================================================== --- trunk/Source/StructureMap/Source/XmlNodeInstanceMemento.cs 2007-04-01 18:18:16 UTC (rev 35) +++ trunk/Source/StructureMap/Source/XmlNodeInstanceMemento.cs 2007-04-01 22:21:15 UTC (rev 36) @@ -1,4 +1,5 @@ using System.Xml; +using StructureMap.Configuration; using StructureMap.Configuration.Tokens; namespace StructureMap.Source @@ -33,6 +34,11 @@ } + protected override string getPluggedType() + { + return getAttribute(XmlConstants.PLUGGED_TYPE); + } + private XmlNode getChildNode(string Key) { string xpath = string.Format("Property[@Name='{0}']", Key); Modified: trunk/Source/StructureMap/Verification/StartUp.cs =================================================================== --- trunk/Source/StructureMap/Verification/StartUp.cs 2007-04-01 18:18:16 UTC (rev 35) +++ trunk/Source/StructureMap/Verification/StartUp.cs 2007-04-01 22:21:15 UTC (rev 36) @@ -61,7 +61,7 @@ PluginGraphConsoleWriter consoleWriter = new PluginGraphConsoleWriter(report); consoleWriter.WriteAll = true; consoleWriter.WriteProblems = true; - + using (TextWriter writer = new StreamWriter(_allFile)) { consoleWriter.Write(writer); Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/UserControlExpressionTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DSL/UserControlExpressionTester.cs 2007-04-01 18:18:16 UTC (rev 35) +++ trunk/Source/StructureMap.Testing/Configuration/DSL/UserControlExpressionTester.cs 2007-04-01 22:21:15 UTC (rev 36) @@ -1,5 +1,4 @@ using NUnit.Framework; -using Rhino.Mocks; using StructureMap.Configuration; using StructureMap.Configuration.DSL; using StructureMap.Graph; @@ -19,9 +18,10 @@ { string theUrl = "alskdjf"; - UserControlExpression expression = new UserControlExpression(typeof(IControl), theUrl); + UserControlExpression expression = new UserControlExpression(typeof (IControl), theUrl); - UserControlMemento memento = (UserControlMemento) ((IMementoBuilder) expression).BuildMemento(new PluginGraph()); + UserControlMemento memento = + (UserControlMemento) ((IMementoBuilder) expression).BuildMemento(new PluginGraph()); Assert.IsNotNull(memento); Assert.AreEqual(theUrl, memento.Url); @@ -35,10 +35,11 @@ string theUrl = "alskdjf"; string theName = "the name"; - UserControlExpression expression = new UserControlExpression(typeof(IControl), theUrl); + UserControlExpression expression = new UserControlExpression(typeof (IControl), theUrl); expression.WithName(theName); - UserControlMemento memento = (UserControlMemento)((IMementoBuilder)expression).BuildMemento(new PluginGraph()); + UserControlMemento memento = + (UserControlMemento) ((IMementoBuilder) expression).BuildMemento(new PluginGraph()); Assert.IsNotNull(memento); Assert.AreEqual(theUrl, memento.Url); @@ -48,6 +49,5 @@ public interface IControl { - } -} +} \ No newline at end of file Added: trunk/Source/StructureMap.Testing/Configuration/DefaultInstanceNodeTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DefaultInstanceNodeTester.cs (rev 0) +++ trunk/Source/StructureMap.Testing/Configuration/DefaultInstanceNodeTester.cs 2007-04-01 22:21:15 UTC (rev 36) @@ -0,0 +1,59 @@ +using NUnit.Framework; +using Rhino.Mocks; +using StructureMap.Attributes; +using StructureMap.Graph; +using StructureMap.Testing.TestData; +using StructureMap.Testing.Widget; + +namespace StructureMap.Testing.Configuration +{ + [TestFixture] + public class DefaultInstanceNodeTester + { + private InstanceManager _manager; + private PluginGraph _graph; + + [SetUp] + public void SetUp() + { + _graph = DataMother.GetPluginGraph("DefaultInstance.xml"); + _manager = new InstanceManager(_graph); + } + + [Test] + public void CreateTheInferredPluginCorrectly() + { + // Who needs the Law of Demeter? + InstanceMemento memento = _graph.PluginFamilies[typeof (IWidget)].Source.GetAllMementos()[0]; + Assert.IsNotEmpty(memento.ConcreteKey); + Assert.IsNotNull(memento.ConcreteKey); + } + + [Test] + public void DefaultNameOfRule() + { + PluginFamily family = _graph.PluginFamilies[typeof (Rule)]; + Assert.AreEqual("TheBlueOne", family.DefaultInstanceKey); + } + + [Test] + public void GetTheWidget() + { + ColorWidget widget = (ColorWidget) _manager.CreateInstance<IWidget>(); + Assert.AreEqual("Red", widget.Color); + + ColorWidget widget2 = (ColorWidget)_manager.CreateInstance<IWidget>(); + Assert.AreNotSame(widget, widget2); + } + + [Test] + public void GetTheRule() + { + ColorRule rule = (ColorRule) _manager.CreateInstance<Rule>(); + Assert.AreEqual("Blue", rule.Color); + + ColorRule rule2 = (ColorRule)_manager.CreateInstance<Rule>(); + Assert.AreSame(rule, rule2); + } + } +} Modified: trunk/Source/StructureMap.Testing/Configuration/FamilyParserTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/FamilyParserTester.cs 2007-04-01 18:18:16 UTC (rev 35) +++ trunk/Source/StructureMap.Testing/Configuration/FamilyParserTester.cs 2007-04-01 22:21:15 UTC (rev 36) @@ -6,6 +6,7 @@ using StructureMap.Configuration; using StructureMap.Graph; using StructureMap.Graph.Configuration; +using StructureMap.Source; using StructureMap.Testing.Widget3; namespace StructureMap.Testing.Configuration @@ -23,7 +24,7 @@ public void SetUp() { _builderMock = new DynamicMock(typeof (IGraphBuilder)); - _parser = new FamilyParser((IGraphBuilder) _builderMock.MockInstance); + _parser = new FamilyParser((IGraphBuilder) _builderMock.MockInstance, new XmlMementoCreator(XmlMementoStyle.NodeNormalized, XmlConstants.TYPE_ATTRIBUTE, XmlConstants.ATTRIBUTE_STYLE)); _document = new XmlDocument(); _document.LoadXml("<PluginFamily />"); Modified: trunk/Source/StructureMap.Testing/GenericsAcceptanceTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/GenericsAcceptanceTester.cs 2007-04-01 18:18:16 UTC (rev 35) +++ trunk/Source/StructureMap.Testing/GenericsAcceptanceTester.cs 2007-04-01 22:21:15 UTC (rev 36) @@ -3,7 +3,6 @@ using System.Reflection; using NUnit.Framework; using StructureMap.Configuration; -using StructureMap.Configuration.DSL; using StructureMap.Configuration.Tokens; using StructureMap.Graph; using StructureMap.Testing.GenericWidgets; @@ -184,7 +183,7 @@ [Test] public void TryDiagnosticsWithGenerics() { - Debug.WriteLine(typeof(ISimpleThing<>).AssemblyQualifiedName); + Debug.WriteLine(typeof (ISimpleThing<>).AssemblyQualifiedName); DataMother.WriteDocument("GenericsTesting.xml"); PluginGraphReport report = PluginGraphBuilder.BuildReportFromXml("GenericsTesting.xml"); Modified: trunk/Source/StructureMap.Testing/ObjectMother.cs =================================================================== --- trunk/Source/StructureMap.Testing/ObjectMother.cs 2007-04-01 18:18:16 UTC (rev 35) +++ trunk/Source/StructureMap.Testing/ObjectMother.cs 2007-04-01 22:21:15 UTC (rev 36) @@ -32,7 +32,6 @@ _instanceManager = new InstanceManager(_pluginGraph); _instanceDefaultManager = _pluginGraph.DefaultManager; - } Modified: trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj =================================================================== --- trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj 2007-04-01 18:18:16 UTC (rev 35) +++ trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj 2007-04-01 22:21:15 UTC (rev 36) @@ -181,6 +181,7 @@ </Compile> <Compile Include="Configuration\ConfigurationParserCollectionTester.cs" /> <Compile Include="Configuration\ConfigurationParserTester.cs" /> + <Compile Include="Configuration\DefaultInstanceNodeTester.cs" /> <Compile Include="Configuration\DiagnosticGraphBuilderTester.cs"> <SubType>Code</SubType> </Compile> @@ -490,6 +491,7 @@ </ItemGroup> <ItemGroup> <Content Include="Sample.xml" /> + <EmbeddedResource Include="TestData\DefaultInstance.xml" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <PropertyGroup> Modified: trunk/Source/StructureMap.Testing/StructureMapConfigurationTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/StructureMapConfigurationTester.cs 2007-04-01 18:18:16 UTC (rev 35) +++ trunk/Source/StructureMap.Testing/StructureMapConfigurationTester.cs 2007-04-01 22:21:15 UTC (rev 36) @@ -30,7 +30,9 @@ Assert.IsNotNull(report); } - [Test, ExpectedException(typeof(ApplicationException), "StructureMap detected configuration or environmental problems. Check the StructureMap error file")] + [Test, + ExpectedException(typeof (ApplicationException), + "StructureMap detected configuration or environmental problems. Check the StructureMap error file")] public void OnStartUpFail() { StructureMapConfiguration.OnStartUp().FailOnException(); @@ -81,16 +83,14 @@ StructureMapConfiguration.UseDefaultStructureMapConfigFile = false; StructureMapConfiguration.PullConfigurationFromAppConfig = true; - ColorThing<string, bool> thing = (ColorThing<string, bool>) ObjectFactory.GetInstance < IThing<string, bool>>(); + ColorThing<string, bool> thing = + (ColorThing<string, bool>) ObjectFactory.GetInstance<IThing<string, bool>>(); Assert.AreEqual("Cornflower", thing.Color, "Cornflower is the color from the App.config file"); } - - } public interface ISomething { - } public class Something : ISomething Modified: trunk/Source/StructureMap.Testing/TestData/DataMother.cs =================================================================== --- trunk/Source/StructureMap.Testing/TestData/DataMother.cs 2007-04-01 18:18:16 UTC (rev 35) +++ trunk/Source/StructureMap.Testing/TestData/DataMother.cs 2007-04-01 22:21:15 UTC (rev 36) @@ -11,8 +11,8 @@ public class DataMother { private static ArrayList _files = new ArrayList(); - + private DataMother() { } Added: trunk/Source/StructureMap.Testing/TestData/DefaultInstance.xml =================================================================== --- trunk/Source/StructureMap.Testing/TestData/DefaultInstance.xml (rev 0) +++ trunk/Source/StructureMap.Testing/TestData/DefaultInstance.xml 2007-04-01 22:21:15 UTC (rev 36) @@ -0,0 +1,4 @@ +<StructureMap MementoStyle="Attribute"> + <DefaultInstance PluginType="StructureMap.Testing.Widget.IWidget,StructureMap.Testing.Widget" PluggedType="StructureMap.Testing.Widget.ColorWidget,StructureMap.Testing.Widget" Color="Red" /> + <DefaultInstance PluginType="StructureMap.Testing.Widget.Rule,StructureMap.Testing.Widget" PluggedType="StructureMap.Testing.Widget.ColorRule,StructureMap.Testing.Widget" Color="Blue" Scope="Singleton" Name="TheBlueOne"/> +</StructureMap> Modified: trunk/Source/StructureMap.Testing.Widget/IWidget.cs =================================================================== --- trunk/Source/StructureMap.Testing.Widget/IWidget.cs 2007-04-01 18:18:16 UTC (rev 35) +++ trunk/Source/StructureMap.Testing.Widget/IWidget.cs 2007-04-01 22:21:15 UTC (rev 36) @@ -47,7 +47,7 @@ public object Clone() { - return this.MemberwiseClone(); + return MemberwiseClone(); } } Modified: trunk/Source/StructureMap.Testing.Widget/Rule.cs =================================================================== --- trunk/Source/StructureMap.Testing.Widget/Rule.cs 2007-04-01 18:18:16 UTC (rev 35) +++ trunk/Source/StructureMap.Testing.Widget/Rule.cs 2007-04-01 22:21:15 UTC (rev 36) @@ -152,6 +152,4 @@ get { return _Value; } } } - - } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2007-04-01 22:59:16
|
Revision: 37 http://structuremap.svn.sourceforge.net/structuremap/?rev=37&view=rev Author: jeremydmiller Date: 2007-04-01 15:59:15 -0700 (Sun, 01 Apr 2007) Log Message: ----------- fixing a build problem with the NAnt targets Modified Paths: -------------- trunk/Source/StructureMap/DeploymentTasks/DeploymentExecutor.cs trunk/cruise.build Modified: trunk/Source/StructureMap/DeploymentTasks/DeploymentExecutor.cs =================================================================== --- trunk/Source/StructureMap/DeploymentTasks/DeploymentExecutor.cs 2007-04-01 22:21:15 UTC (rev 36) +++ trunk/Source/StructureMap/DeploymentTasks/DeploymentExecutor.cs 2007-04-01 22:59:15 UTC (rev 37) @@ -65,7 +65,7 @@ _sourceConfigDocument = new XmlDocument(); _sourceConfigDocument.Load(configPath); - PluginGraphBuilder builder = new PluginGraphBuilder(new ConfigurationParser(_sourceConfigDocument)); + PluginGraphBuilder builder = new PluginGraphBuilder(new ConfigurationParser(_sourceConfigDocument.DocumentElement)); _report = createPluginGraphReport(builder); _defaultManager = builder.DefaultManager; Modified: trunk/cruise.build =================================================================== --- trunk/cruise.build 2007-04-01 22:21:15 UTC (rev 36) +++ trunk/cruise.build 2007-04-01 22:59:15 UTC (rev 37) @@ -123,11 +123,11 @@ <exec program="${nunit-console.exe}" workingdir="${build.dir}"> <arg value="StructureMap.Testing.dll" /> </exec> -<!-- + <exec program="${nunit-console.exe}" workingdir="${build.dir}"> <arg value="StructureMap.Testing.DeploymentTasks.dll" /> </exec> ---> + </target> <target name="runDoctor"> @@ -148,13 +148,14 @@ <target name="post-clean"> <call target="cleanJunk" /> - + <delete> <fileset basedir="${build.dir}"> <include name="*.xml" /> <include name="*.config" /> </fileset> </delete> + </target> <target name="archive"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2007-04-01 23:14:44
|
Revision: 38 http://structuremap.svn.sourceforge.net/structuremap/?rev=38&view=rev Author: jeremydmiller Date: 2007-04-01 16:14:43 -0700 (Sun, 01 Apr 2007) Log Message: ----------- testing the UserControl option, uploading binaries Modified Paths: -------------- trunk/Source/StructureMap.sln trunk/StructureMap.config trunk/bin/NUnit/NUnitTests.config trunk/bin/NUnit/NUnitTests.nunit trunk/bin/NUnit/TestResult.xml trunk/bin/NUnit/mock-assembly.dll trunk/bin/NUnit/nonamespace-assembly.dll trunk/bin/NUnit/notestfixtures-assembly.dll trunk/bin/NUnit/nunit-console-runner.dll trunk/bin/NUnit/nunit-console.exe trunk/bin/NUnit/nunit-console.exe.config trunk/bin/NUnit/nunit-console.tests.dll trunk/bin/NUnit/nunit-gui-runner.dll trunk/bin/NUnit/nunit-gui.exe trunk/bin/NUnit/nunit-gui.tests.dll trunk/bin/NUnit/nunit.core.dll trunk/bin/NUnit/nunit.core.extensions.dll trunk/bin/NUnit/nunit.extensions.tests.dll trunk/bin/NUnit/nunit.framework.dll trunk/bin/NUnit/nunit.framework.tests.dll trunk/bin/NUnit/nunit.framework.xml trunk/bin/NUnit/nunit.mocks.dll trunk/bin/NUnit/nunit.mocks.tests.dll trunk/bin/NUnit/nunit.uikit.dll trunk/bin/NUnit/nunit.uikit.tests.dll trunk/bin/NUnit/nunit.util.dll trunk/bin/NUnit/nunit.util.tests.dll trunk/bin/NUnit/test-utilities.dll trunk/bin/NUnit/timing-tests.dll Modified: trunk/Source/StructureMap.sln =================================================================== --- trunk/Source/StructureMap.sln 2007-04-01 22:59:15 UTC (rev 37) +++ trunk/Source/StructureMap.sln 2007-04-01 23:14:43 UTC (rev 38) @@ -54,108 +54,276 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GUI", "GUI", "{4F638ECF-2A69-4D6A-9B68-05CC40951217}" EndProject +Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "D:\StructureMap\StructureMapTest\", "..\StructureMapTest\", "{6C0DF673-322F-4AB9-A020-924661EF0CAB}" + ProjectSection(WebsiteProperties) = preProject + ProjectReferences = "{3F36EA80-2F9A-4DAD-BA27-5AC6163A2EE3}|StructureMap.dll;" + Debug.AspNetCompiler.VirtualPath = "/StructureMapTest" + Debug.AspNetCompiler.PhysicalPath = "..\StructureMapTest\" + Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\StructureMapTest\" + Debug.AspNetCompiler.Updateable = "true" + Debug.AspNetCompiler.ForceOverwrite = "true" + Debug.AspNetCompiler.FixedNames = "false" + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.VirtualPath = "/StructureMapTest" + Release.AspNetCompiler.PhysicalPath = "..\StructureMapTest\" + Release.AspNetCompiler.TargetPath = "PrecompiledWeb\StructureMapTest\" + Release.AspNetCompiler.Updateable = "true" + Release.AspNetCompiler.ForceOverwrite = "true" + Release.AspNetCompiler.FixedNames = "false" + Release.AspNetCompiler.Debug = "False" + VWDPort = "4438" + DefaultWebSiteLanguage = "Visual C#" + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Build|.NET = Build|.NET Build|Any CPU = Build|Any CPU + Build|Mixed Platforms = Build|Mixed Platforms + Debug|.NET = Debug|.NET Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Release|.NET = Release|.NET Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3F36EA80-2F9A-4DAD-BA27-5AC6163A2EE3}.Build|.NET.ActiveCfg = Build|Any CPU {3F36EA80-2F9A-4DAD-BA27-5AC6163A2EE3}.Build|Any CPU.ActiveCfg = Build|Any CPU {3F36EA80-2F9A-4DAD-BA27-5AC6163A2EE3}.Build|Any CPU.Build.0 = Build|Any CPU + {3F36EA80-2F9A-4DAD-BA27-5AC6163A2EE3}.Build|Mixed Platforms.ActiveCfg = Build|Any CPU + {3F36EA80-2F9A-4DAD-BA27-5AC6163A2EE3}.Build|Mixed Platforms.Build.0 = Build|Any CPU + {3F36EA80-2F9A-4DAD-BA27-5AC6163A2EE3}.Debug|.NET.ActiveCfg = Debug|Any CPU {3F36EA80-2F9A-4DAD-BA27-5AC6163A2EE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3F36EA80-2F9A-4DAD-BA27-5AC6163A2EE3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3F36EA80-2F9A-4DAD-BA27-5AC6163A2EE3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {3F36EA80-2F9A-4DAD-BA27-5AC6163A2EE3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {3F36EA80-2F9A-4DAD-BA27-5AC6163A2EE3}.Release|.NET.ActiveCfg = Release|Any CPU {3F36EA80-2F9A-4DAD-BA27-5AC6163A2EE3}.Release|Any CPU.ActiveCfg = Release|Any CPU {3F36EA80-2F9A-4DAD-BA27-5AC6163A2EE3}.Release|Any CPU.Build.0 = Release|Any CPU + {3F36EA80-2F9A-4DAD-BA27-5AC6163A2EE3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {3F36EA80-2F9A-4DAD-BA27-5AC6163A2EE3}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {52CDE969-625F-4FB6-8EC5-CD297FD809CA}.Build|.NET.ActiveCfg = Release|Any CPU {52CDE969-625F-4FB6-8EC5-CD297FD809CA}.Build|Any CPU.ActiveCfg = Release|Any CPU {52CDE969-625F-4FB6-8EC5-CD297FD809CA}.Build|Any CPU.Build.0 = Release|Any CPU + {52CDE969-625F-4FB6-8EC5-CD297FD809CA}.Build|Mixed Platforms.ActiveCfg = Release|Any CPU + {52CDE969-625F-4FB6-8EC5-CD297FD809CA}.Build|Mixed Platforms.Build.0 = Release|Any CPU + {52CDE969-625F-4FB6-8EC5-CD297FD809CA}.Debug|.NET.ActiveCfg = Debug|Any CPU {52CDE969-625F-4FB6-8EC5-CD297FD809CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {52CDE969-625F-4FB6-8EC5-CD297FD809CA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {52CDE969-625F-4FB6-8EC5-CD297FD809CA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {52CDE969-625F-4FB6-8EC5-CD297FD809CA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {52CDE969-625F-4FB6-8EC5-CD297FD809CA}.Release|.NET.ActiveCfg = Release|Any CPU {52CDE969-625F-4FB6-8EC5-CD297FD809CA}.Release|Any CPU.ActiveCfg = Release|Any CPU {52CDE969-625F-4FB6-8EC5-CD297FD809CA}.Release|Any CPU.Build.0 = Release|Any CPU + {52CDE969-625F-4FB6-8EC5-CD297FD809CA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {52CDE969-625F-4FB6-8EC5-CD297FD809CA}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {63C2742D-B6E2-484F-AFDB-346873075C5E}.Build|.NET.ActiveCfg = Release|Any CPU {63C2742D-B6E2-484F-AFDB-346873075C5E}.Build|Any CPU.ActiveCfg = Release|Any CPU {63C2742D-B6E2-484F-AFDB-346873075C5E}.Build|Any CPU.Build.0 = Release|Any CPU + {63C2742D-B6E2-484F-AFDB-346873075C5E}.Build|Mixed Platforms.ActiveCfg = Release|Any CPU + {63C2742D-B6E2-484F-AFDB-346873075C5E}.Build|Mixed Platforms.Build.0 = Release|Any CPU + {63C2742D-B6E2-484F-AFDB-346873075C5E}.Debug|.NET.ActiveCfg = Debug|Any CPU {63C2742D-B6E2-484F-AFDB-346873075C5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {63C2742D-B6E2-484F-AFDB-346873075C5E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {63C2742D-B6E2-484F-AFDB-346873075C5E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {63C2742D-B6E2-484F-AFDB-346873075C5E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {63C2742D-B6E2-484F-AFDB-346873075C5E}.Release|.NET.ActiveCfg = Release|Any CPU {63C2742D-B6E2-484F-AFDB-346873075C5E}.Release|Any CPU.ActiveCfg = Release|Any CPU {63C2742D-B6E2-484F-AFDB-346873075C5E}.Release|Any CPU.Build.0 = Release|Any CPU + {63C2742D-B6E2-484F-AFDB-346873075C5E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {63C2742D-B6E2-484F-AFDB-346873075C5E}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {E21E1651-3E32-47B7-A290-F461E63FEAD2}.Build|.NET.ActiveCfg = Release|Any CPU {E21E1651-3E32-47B7-A290-F461E63FEAD2}.Build|Any CPU.ActiveCfg = Release|Any CPU {E21E1651-3E32-47B7-A290-F461E63FEAD2}.Build|Any CPU.Build.0 = Release|Any CPU + {E21E1651-3E32-47B7-A290-F461E63FEAD2}.Build|Mixed Platforms.ActiveCfg = Release|Any CPU + {E21E1651-3E32-47B7-A290-F461E63FEAD2}.Build|Mixed Platforms.Build.0 = Release|Any CPU + {E21E1651-3E32-47B7-A290-F461E63FEAD2}.Debug|.NET.ActiveCfg = Debug|Any CPU {E21E1651-3E32-47B7-A290-F461E63FEAD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E21E1651-3E32-47B7-A290-F461E63FEAD2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E21E1651-3E32-47B7-A290-F461E63FEAD2}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {E21E1651-3E32-47B7-A290-F461E63FEAD2}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {E21E1651-3E32-47B7-A290-F461E63FEAD2}.Release|.NET.ActiveCfg = Release|Any CPU {E21E1651-3E32-47B7-A290-F461E63FEAD2}.Release|Any CPU.ActiveCfg = Release|Any CPU {E21E1651-3E32-47B7-A290-F461E63FEAD2}.Release|Any CPU.Build.0 = Release|Any CPU + {E21E1651-3E32-47B7-A290-F461E63FEAD2}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {E21E1651-3E32-47B7-A290-F461E63FEAD2}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {027E996C-75E8-40F8-9073-0E3B77A6BE1F}.Build|.NET.ActiveCfg = Release|Any CPU {027E996C-75E8-40F8-9073-0E3B77A6BE1F}.Build|Any CPU.ActiveCfg = Release|Any CPU {027E996C-75E8-40F8-9073-0E3B77A6BE1F}.Build|Any CPU.Build.0 = Release|Any CPU + {027E996C-75E8-40F8-9073-0E3B77A6BE1F}.Build|Mixed Platforms.ActiveCfg = Release|Any CPU + {027E996C-75E8-40F8-9073-0E3B77A6BE1F}.Build|Mixed Platforms.Build.0 = Release|Any CPU + {027E996C-75E8-40F8-9073-0E3B77A6BE1F}.Debug|.NET.ActiveCfg = Debug|Any CPU {027E996C-75E8-40F8-9073-0E3B77A6BE1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {027E996C-75E8-40F8-9073-0E3B77A6BE1F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {027E996C-75E8-40F8-9073-0E3B77A6BE1F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {027E996C-75E8-40F8-9073-0E3B77A6BE1F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {027E996C-75E8-40F8-9073-0E3B77A6BE1F}.Release|.NET.ActiveCfg = Release|Any CPU {027E996C-75E8-40F8-9073-0E3B77A6BE1F}.Release|Any CPU.ActiveCfg = Release|Any CPU {027E996C-75E8-40F8-9073-0E3B77A6BE1F}.Release|Any CPU.Build.0 = Release|Any CPU + {027E996C-75E8-40F8-9073-0E3B77A6BE1F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {027E996C-75E8-40F8-9073-0E3B77A6BE1F}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {C8878328-281F-4F4F-8D6E-88C60F304B89}.Build|.NET.ActiveCfg = Release|Any CPU {C8878328-281F-4F4F-8D6E-88C60F304B89}.Build|Any CPU.ActiveCfg = Release|Any CPU {C8878328-281F-4F4F-8D6E-88C60F304B89}.Build|Any CPU.Build.0 = Release|Any CPU + {C8878328-281F-4F4F-8D6E-88C60F304B89}.Build|Mixed Platforms.ActiveCfg = Release|Any CPU + {C8878328-281F-4F4F-8D6E-88C60F304B89}.Build|Mixed Platforms.Build.0 = Release|Any CPU + {C8878328-281F-4F4F-8D6E-88C60F304B89}.Debug|.NET.ActiveCfg = Debug|Any CPU {C8878328-281F-4F4F-8D6E-88C60F304B89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C8878328-281F-4F4F-8D6E-88C60F304B89}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C8878328-281F-4F4F-8D6E-88C60F304B89}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {C8878328-281F-4F4F-8D6E-88C60F304B89}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {C8878328-281F-4F4F-8D6E-88C60F304B89}.Release|.NET.ActiveCfg = Release|Any CPU {C8878328-281F-4F4F-8D6E-88C60F304B89}.Release|Any CPU.ActiveCfg = Release|Any CPU {C8878328-281F-4F4F-8D6E-88C60F304B89}.Release|Any CPU.Build.0 = Release|Any CPU + {C8878328-281F-4F4F-8D6E-88C60F304B89}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {C8878328-281F-4F4F-8D6E-88C60F304B89}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {901D15CB-EF37-4F84-864B-E70F4B5F1DFF}.Build|.NET.ActiveCfg = Release|Any CPU {901D15CB-EF37-4F84-864B-E70F4B5F1DFF}.Build|Any CPU.ActiveCfg = Release|Any CPU {901D15CB-EF37-4F84-864B-E70F4B5F1DFF}.Build|Any CPU.Build.0 = Release|Any CPU + {901D15CB-EF37-4F84-864B-E70F4B5F1DFF}.Build|Mixed Platforms.ActiveCfg = Release|Any CPU + {901D15CB-EF37-4F84-864B-E70F4B5F1DFF}.Build|Mixed Platforms.Build.0 = Release|Any CPU + {901D15CB-EF37-4F84-864B-E70F4B5F1DFF}.Debug|.NET.ActiveCfg = Debug|Any CPU {901D15CB-EF37-4F84-864B-E70F4B5F1DFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {901D15CB-EF37-4F84-864B-E70F4B5F1DFF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {901D15CB-EF37-4F84-864B-E70F4B5F1DFF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {901D15CB-EF37-4F84-864B-E70F4B5F1DFF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {901D15CB-EF37-4F84-864B-E70F4B5F1DFF}.Release|.NET.ActiveCfg = Release|Any CPU {901D15CB-EF37-4F84-864B-E70F4B5F1DFF}.Release|Any CPU.ActiveCfg = Release|Any CPU {901D15CB-EF37-4F84-864B-E70F4B5F1DFF}.Release|Any CPU.Build.0 = Release|Any CPU + {901D15CB-EF37-4F84-864B-E70F4B5F1DFF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {901D15CB-EF37-4F84-864B-E70F4B5F1DFF}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {CAB97F7F-FB75-410C-898A-88DCAAC036BE}.Build|.NET.ActiveCfg = Release|Any CPU {CAB97F7F-FB75-410C-898A-88DCAAC036BE}.Build|Any CPU.ActiveCfg = Release|Any CPU {CAB97F7F-FB75-410C-898A-88DCAAC036BE}.Build|Any CPU.Build.0 = Release|Any CPU + {CAB97F7F-FB75-410C-898A-88DCAAC036BE}.Build|Mixed Platforms.ActiveCfg = Release|Any CPU + {CAB97F7F-FB75-410C-898A-88DCAAC036BE}.Build|Mixed Platforms.Build.0 = Release|Any CPU + {CAB97F7F-FB75-410C-898A-88DCAAC036BE}.Debug|.NET.ActiveCfg = Debug|Any CPU {CAB97F7F-FB75-410C-898A-88DCAAC036BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CAB97F7F-FB75-410C-898A-88DCAAC036BE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CAB97F7F-FB75-410C-898A-88DCAAC036BE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {CAB97F7F-FB75-410C-898A-88DCAAC036BE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {CAB97F7F-FB75-410C-898A-88DCAAC036BE}.Release|.NET.ActiveCfg = Release|Any CPU {CAB97F7F-FB75-410C-898A-88DCAAC036BE}.Release|Any CPU.ActiveCfg = Release|Any CPU {CAB97F7F-FB75-410C-898A-88DCAAC036BE}.Release|Any CPU.Build.0 = Release|Any CPU + {CAB97F7F-FB75-410C-898A-88DCAAC036BE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {CAB97F7F-FB75-410C-898A-88DCAAC036BE}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {DB6A0B91-873E-4E04-866A-7483E136A8D4}.Build|.NET.ActiveCfg = Release|Any CPU {DB6A0B91-873E-4E04-866A-7483E136A8D4}.Build|Any CPU.ActiveCfg = Release|Any CPU {DB6A0B91-873E-4E04-866A-7483E136A8D4}.Build|Any CPU.Build.0 = Release|Any CPU + {DB6A0B91-873E-4E04-866A-7483E136A8D4}.Build|Mixed Platforms.ActiveCfg = Release|Any CPU + {DB6A0B91-873E-4E04-866A-7483E136A8D4}.Build|Mixed Platforms.Build.0 = Release|Any CPU + {DB6A0B91-873E-4E04-866A-7483E136A8D4}.Debug|.NET.ActiveCfg = Debug|Any CPU {DB6A0B91-873E-4E04-866A-7483E136A8D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DB6A0B91-873E-4E04-866A-7483E136A8D4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DB6A0B91-873E-4E04-866A-7483E136A8D4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {DB6A0B91-873E-4E04-866A-7483E136A8D4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {DB6A0B91-873E-4E04-866A-7483E136A8D4}.Release|.NET.ActiveCfg = Release|Any CPU {DB6A0B91-873E-4E04-866A-7483E136A8D4}.Release|Any CPU.ActiveCfg = Release|Any CPU {DB6A0B91-873E-4E04-866A-7483E136A8D4}.Release|Any CPU.Build.0 = Release|Any CPU + {DB6A0B91-873E-4E04-866A-7483E136A8D4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {DB6A0B91-873E-4E04-866A-7483E136A8D4}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {195EB3B0-96D2-4047-B091-E858690C741C}.Build|.NET.ActiveCfg = Release|Any CPU {195EB3B0-96D2-4047-B091-E858690C741C}.Build|Any CPU.ActiveCfg = Release|Any CPU {195EB3B0-96D2-4047-B091-E858690C741C}.Build|Any CPU.Build.0 = Release|Any CPU + {195EB3B0-96D2-4047-B091-E858690C741C}.Build|Mixed Platforms.ActiveCfg = Release|Any CPU + {195EB3B0-96D2-4047-B091-E858690C741C}.Build|Mixed Platforms.Build.0 = Release|Any CPU + {195EB3B0-96D2-4047-B091-E858690C741C}.Debug|.NET.ActiveCfg = Debug|Any CPU {195EB3B0-96D2-4047-B091-E858690C741C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {195EB3B0-96D2-4047-B091-E858690C741C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {195EB3B0-96D2-4047-B091-E858690C741C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {195EB3B0-96D2-4047-B091-E858690C741C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {195EB3B0-96D2-4047-B091-E858690C741C}.Release|.NET.ActiveCfg = Release|Any CPU {195EB3B0-96D2-4047-B091-E858690C741C}.Release|Any CPU.ActiveCfg = Release|Any CPU {195EB3B0-96D2-4047-B091-E858690C741C}.Release|Any CPU.Build.0 = Release|Any CPU + {195EB3B0-96D2-4047-B091-E858690C741C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {195EB3B0-96D2-4047-B091-E858690C741C}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {887C4441-07A4-489D-B8D9-EFE9D28A47CA}.Build|.NET.ActiveCfg = Release|Any CPU {887C4441-07A4-489D-B8D9-EFE9D28A47CA}.Build|Any CPU.ActiveCfg = Release|Any CPU {887C4441-07A4-489D-B8D9-EFE9D28A47CA}.Build|Any CPU.Build.0 = Release|Any CPU + {887C4441-07A4-489D-B8D9-EFE9D28A47CA}.Build|Mixed Platforms.ActiveCfg = Release|Any CPU + {887C4441-07A4-489D-B8D9-EFE9D28A47CA}.Build|Mixed Platforms.Build.0 = Release|Any CPU + {887C4441-07A4-489D-B8D9-EFE9D28A47CA}.Debug|.NET.ActiveCfg = Debug|Any CPU {887C4441-07A4-489D-B8D9-EFE9D28A47CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {887C4441-07A4-489D-B8D9-EFE9D28A47CA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {887C4441-07A4-489D-B8D9-EFE9D28A47CA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {887C4441-07A4-489D-B8D9-EFE9D28A47CA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {887C4441-07A4-489D-B8D9-EFE9D28A47CA}.Release|.NET.ActiveCfg = Release|Any CPU {887C4441-07A4-489D-B8D9-EFE9D28A47CA}.Release|Any CPU.ActiveCfg = Release|Any CPU {887C4441-07A4-489D-B8D9-EFE9D28A47CA}.Release|Any CPU.Build.0 = Release|Any CPU + {887C4441-07A4-489D-B8D9-EFE9D28A47CA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {887C4441-07A4-489D-B8D9-EFE9D28A47CA}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {51039D04-6DB6-44BD-B827-39C86482D9F0}.Build|.NET.ActiveCfg = Release|Any CPU {51039D04-6DB6-44BD-B827-39C86482D9F0}.Build|Any CPU.ActiveCfg = Release|Any CPU {51039D04-6DB6-44BD-B827-39C86482D9F0}.Build|Any CPU.Build.0 = Release|Any CPU + {51039D04-6DB6-44BD-B827-39C86482D9F0}.Build|Mixed Platforms.ActiveCfg = Release|Any CPU + {51039D04-6DB6-44BD-B827-39C86482D9F0}.Build|Mixed Platforms.Build.0 = Release|Any CPU + {51039D04-6DB6-44BD-B827-39C86482D9F0}.Debug|.NET.ActiveCfg = Debug|Any CPU {51039D04-6DB6-44BD-B827-39C86482D9F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {51039D04-6DB6-44BD-B827-39C86482D9F0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {51039D04-6DB6-44BD-B827-39C86482D9F0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {51039D04-6DB6-44BD-B827-39C86482D9F0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {51039D04-6DB6-44BD-B827-39C86482D9F0}.Release|.NET.ActiveCfg = Release|Any CPU {51039D04-6DB6-44BD-B827-39C86482D9F0}.Release|Any CPU.ActiveCfg = Release|Any CPU {51039D04-6DB6-44BD-B827-39C86482D9F0}.Release|Any CPU.Build.0 = Release|Any CPU + {51039D04-6DB6-44BD-B827-39C86482D9F0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {51039D04-6DB6-44BD-B827-39C86482D9F0}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {C205EA4C-4CD0-4221-A3CB-AFD835F0B263}.Build|.NET.ActiveCfg = Release|Any CPU {C205EA4C-4CD0-4221-A3CB-AFD835F0B263}.Build|Any CPU.ActiveCfg = Release|Any CPU {C205EA4C-4CD0-4221-A3CB-AFD835F0B263}.Build|Any CPU.Build.0 = Release|Any CPU + {C205EA4C-4CD0-4221-A3CB-AFD835F0B263}.Build|Mixed Platforms.ActiveCfg = Release|Any CPU + {C205EA4C-4CD0-4221-A3CB-AFD835F0B263}.Build|Mixed Platforms.Build.0 = Release|Any CPU + {C205EA4C-4CD0-4221-A3CB-AFD835F0B263}.Debug|.NET.ActiveCfg = Debug|Any CPU {C205EA4C-4CD0-4221-A3CB-AFD835F0B263}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C205EA4C-4CD0-4221-A3CB-AFD835F0B263}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C205EA4C-4CD0-4221-A3CB-AFD835F0B263}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {C205EA4C-4CD0-4221-A3CB-AFD835F0B263}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {C205EA4C-4CD0-4221-A3CB-AFD835F0B263}.Release|.NET.ActiveCfg = Release|Any CPU {C205EA4C-4CD0-4221-A3CB-AFD835F0B263}.Release|Any CPU.ActiveCfg = Release|Any CPU {C205EA4C-4CD0-4221-A3CB-AFD835F0B263}.Release|Any CPU.Build.0 = Release|Any CPU + {C205EA4C-4CD0-4221-A3CB-AFD835F0B263}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {C205EA4C-4CD0-4221-A3CB-AFD835F0B263}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {DB798C07-0C82-4298-8BAA-D702CF96C28E}.Build|.NET.ActiveCfg = Release|Any CPU {DB798C07-0C82-4298-8BAA-D702CF96C28E}.Build|Any CPU.ActiveCfg = Release|Any CPU {DB798C07-0C82-4298-8BAA-D702CF96C28E}.Build|Any CPU.Build.0 = Release|Any CPU + {DB798C07-0C82-4298-8BAA-D702CF96C28E}.Build|Mixed Platforms.ActiveCfg = Release|Any CPU + {DB798C07-0C82-4298-8BAA-D702CF96C28E}.Build|Mixed Platforms.Build.0 = Release|Any CPU + {DB798C07-0C82-4298-8BAA-D702CF96C28E}.Debug|.NET.ActiveCfg = Debug|Any CPU {DB798C07-0C82-4298-8BAA-D702CF96C28E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DB798C07-0C82-4298-8BAA-D702CF96C28E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DB798C07-0C82-4298-8BAA-D702CF96C28E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {DB798C07-0C82-4298-8BAA-D702CF96C28E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {DB798C07-0C82-4298-8BAA-D702CF96C28E}.Release|.NET.ActiveCfg = Release|Any CPU {DB798C07-0C82-4298-8BAA-D702CF96C28E}.Release|Any CPU.ActiveCfg = Release|Any CPU {DB798C07-0C82-4298-8BAA-D702CF96C28E}.Release|Any CPU.Build.0 = Release|Any CPU + {DB798C07-0C82-4298-8BAA-D702CF96C28E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {DB798C07-0C82-4298-8BAA-D702CF96C28E}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {6C0DF673-322F-4AB9-A020-924661EF0CAB}.Build|.NET.ActiveCfg = Debug|.NET + {6C0DF673-322F-4AB9-A020-924661EF0CAB}.Build|.NET.Build.0 = Debug|.NET + {6C0DF673-322F-4AB9-A020-924661EF0CAB}.Build|Any CPU.ActiveCfg = Debug|.NET + {6C0DF673-322F-4AB9-A020-924661EF0CAB}.Build|Mixed Platforms.ActiveCfg = Debug|.NET + {6C0DF673-322F-4AB9-A020-924661EF0CAB}.Build|Mixed Platforms.Build.0 = Debug|.NET + {6C0DF673-322F-4AB9-A020-924661EF0CAB}.Debug|.NET.ActiveCfg = Debug|.NET + {6C0DF673-322F-4AB9-A020-924661EF0CAB}.Debug|.NET.Build.0 = Debug|.NET + {6C0DF673-322F-4AB9-A020-924661EF0CAB}.Debug|Any CPU.ActiveCfg = Debug|.NET + {6C0DF673-322F-4AB9-A020-924661EF0CAB}.Debug|Mixed Platforms.ActiveCfg = Debug|.NET + {6C0DF673-322F-4AB9-A020-924661EF0CAB}.Debug|Mixed Platforms.Build.0 = Debug|.NET + {6C0DF673-322F-4AB9-A020-924661EF0CAB}.Release|.NET.ActiveCfg = Debug|.NET + {6C0DF673-322F-4AB9-A020-924661EF0CAB}.Release|.NET.Build.0 = Debug|.NET + {6C0DF673-322F-4AB9-A020-924661EF0CAB}.Release|Any CPU.ActiveCfg = Debug|.NET + {6C0DF673-322F-4AB9-A020-924661EF0CAB}.Release|Mixed Platforms.ActiveCfg = Debug|.NET + {6C0DF673-322F-4AB9-A020-924661EF0CAB}.Release|Mixed Platforms.Build.0 = Debug|.NET EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {C205EA4C-4CD0-4221-A3CB-AFD835F0B263} = {E1C10209-160D-4054-ACB7-478A9FDCF84C} - {E21E1651-3E32-47B7-A290-F461E63FEAD2} = {E1C10209-160D-4054-ACB7-478A9FDCF84C} {027E996C-75E8-40F8-9073-0E3B77A6BE1F} = {E1C10209-160D-4054-ACB7-478A9FDCF84C} {C8878328-281F-4F4F-8D6E-88C60F304B89} = {E1C10209-160D-4054-ACB7-478A9FDCF84C} {901D15CB-EF37-4F84-864B-E70F4B5F1DFF} = {E1C10209-160D-4054-ACB7-478A9FDCF84C} {CAB97F7F-FB75-410C-898A-88DCAAC036BE} = {E1C10209-160D-4054-ACB7-478A9FDCF84C} + {C205EA4C-4CD0-4221-A3CB-AFD835F0B263} = {E1C10209-160D-4054-ACB7-478A9FDCF84C} + {E21E1651-3E32-47B7-A290-F461E63FEAD2} = {E1C10209-160D-4054-ACB7-478A9FDCF84C} {51039D04-6DB6-44BD-B827-39C86482D9F0} = {4F638ECF-2A69-4D6A-9B68-05CC40951217} {887C4441-07A4-489D-B8D9-EFE9D28A47CA} = {4F638ECF-2A69-4D6A-9B68-05CC40951217} EndGlobalSection Modified: trunk/StructureMap.config =================================================================== --- trunk/StructureMap.config 2007-04-01 22:59:15 UTC (rev 37) +++ trunk/StructureMap.config 2007-04-01 23:14:43 UTC (rev 38) @@ -1,10 +1,10 @@ <!--<?xml version="1.0" encoding="utf-8" ?>--> -<StructureMap DefaultProfile="TheDefaultProfile"> +<StructureMap DefaultProfile="TheDefaultProfile" Id="Main"> <Assembly Name="StructureMap.Testing.Widget" Deploy="Client, Test, Server"/> <Assembly Name="StructureMap.Testing.Widget2" Deploy="Remote"/> <Assembly Name="StructureMap.Testing.Widget3"/> - <!--<Assembly Name="FieldAgent.UI" />--> + <Profile Name="TheDefaultProfile"> <Override Type="StructureMap.Testing.Widget.GrandChild" DefaultKey="Todd"/> </Profile> Modified: trunk/bin/NUnit/NUnitTests.config =================================================================== --- trunk/bin/NUnit/NUnitTests.config 2007-04-01 22:59:15 UTC (rev 37) +++ trunk/bin/NUnit/NUnitTests.config 2007-04-01 23:14:43 UTC (rev 38) @@ -27,10 +27,14 @@ <appSettings> <!-- User application and configured property settings go here.--> <!-- Example: <add key="settingName" value="settingValue"/> --> + + <!-- The following is used by the NUnit tests. TODO: REMOVE --> <add key="test.setting" value="54321" /> </appSettings> - <NUnit> + <!-- The following settings for NUnit are not actually needed, but are --> + <!-- provided for documentation purposes. The values are all defaults. --> + <NUnit> <TestCaseBuilder> <add key="OldStyleTestCases" value="false" /> </TestCaseBuilder> Modified: trunk/bin/NUnit/NUnitTests.nunit =================================================================== --- trunk/bin/NUnit/NUnitTests.nunit 2007-04-01 22:59:15 UTC (rev 37) +++ trunk/bin/NUnit/NUnitTests.nunit 2007-04-01 23:14:43 UTC (rev 38) @@ -1,11 +1,13 @@ <NUnitProject> <Config name="Default" binpathtype="Auto"> <assembly path="nunit.framework.tests.dll" /> + <assembly path="nunit.core.tests.dll" /> <assembly path="nunit.util.tests.dll" /> <assembly path="nunit.mocks.tests.dll" /> + <assembly path="nunit.extensions.tests.dll" /> + <assembly path="nunit-console.tests.dll" /> <assembly path="nunit.uikit.tests.dll" /> - <assembly path="nunit-console.tests.dll" /> <assembly path="nunit-gui.tests.dll" /> - <assembly path="nunit.extensions.tests.dll" /> + <assembly path="nunit.fixtures.tests.dll" /> </Config> </NUnitProject> Modified: trunk/bin/NUnit/TestResult.xml =================================================================== --- trunk/bin/NUnit/TestResult.xml 2007-04-01 22:59:15 UTC (rev 37) +++ trunk/bin/NUnit/TestResult.xml 2007-04-01 23:14:43 UTC (rev 38) @@ -1,1269 +1,600 @@ <?xml version="1.0" encoding="utf-8" standalone="no"?> <!--This file represents the results of running a test suite--> -<test-results name="D:\Dev\NUnit\nunit20-release-branch\src\build\net\1.1\release\NUnitTests.nunit" total="753" failures="0" not-run="0" date="2006-01-22" time="12:24:00"> - <environment nunit-version="2.2.6.0" clr-version="1.1.4322.573" os-version="Microsoft Windows NT 5.0.2195.0" platform="Win32NT" cwd="D:\Dev\NUnit\nunit20-release-branch\src\build\net\1.1\release" machine-name="BIRCH" user="Charlie" user-domain="BIRCH" /> +<test-results name="..\..\1.1\release\nunit.framework.tests.dll" total="388" failures="0" not-run="0" date="2007-03-02" time="21:26:07"> + <environment nunit-version="2.4.0.0" clr-version="2.0.50727.42" os-version="Microsoft Windows NT 5.1.2600 Service Pack 2" platform="Win32NT" cwd="D:\Dev\NUnit\nunit-2.4\build\net\2.0\release" machine-name="FERRARI" user="Charlie" user-domain="FERRARI" /> <culture-info current-culture="en-US" current-uiculture="en-US" /> - <test-suite name="D:\Dev\NUnit\nunit20-release-branch\src\build\net\1.1\release\NUnitTests.nunit" success="True" time="78.873" asserts="0"> + <test-suite name="..\..\1.1\release\nunit.framework.tests.dll" success="True" time="1.078" asserts="0"> <results> - <test-suite name="D:\Dev\NUnit\nunit20-release-branch\src\build\net\1.1\release\nunit.framework.tests.dll" success="True" time="10.575" asserts="0"> + <test-suite name="NUnit" success="True" time="1.078" asserts="0"> <results> - <test-suite name="NUnit" success="True" time="10.455" asserts="0"> + <test-suite name="Framework" success="True" time="1.078" asserts="0"> <results> - <test-suite name="Framework" success="True" time="1.853" asserts="0"> + <test-suite name="Constraints" success="True" time="0.125" asserts="0"> <results> - <test-suite name="Tests" success="True" time="1.853" asserts="0"> + <test-suite name="Tests" success="True" time="0.125" asserts="0"> <results> - <test-suite name="ArrayEqualsFixture" success="True" time="0.371" asserts="0"> + <test-suite name="AllItemsTests" success="True" time="0.031" asserts="0"> <results> - <test-case name="NUnit.Framework.Tests.ArrayEqualsFixture.SameArraysAreEqual" executed="True" success="True" time="0.020" asserts="2" /> - <test-case name="NUnit.Framework.Tests.ArrayEqualsFixture.DifferentArraysAreEqual" executed="True" success="True" time="0.000" asserts="2" /> - <test-case name="NUnit.Framework.Tests.ArrayEqualsFixture.DifferentLengthArrays" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.ArrayEqualsFixture.SameLengthDifferentContent" executed="True" success="True" time="0.010" asserts="1" /> - <test-case name="NUnit.Framework.Tests.ArrayEqualsFixture.DifferentArrayTypesButEqual" executed="True" success="True" time="0.000" asserts="2" /> - <test-case name="NUnit.Framework.Tests.ArrayEqualsFixture.MixedTypesAreEqual" executed="True" success="True" time="0.010" asserts="1" /> - <test-case name="NUnit.Framework.Tests.ArrayEqualsFixture.DifferentArrayTypesNotEqual" executed="True" success="True" time="0.000" asserts="2" /> - <test-case name="NUnit.Framework.Tests.ArrayEqualsFixture.ArraysOfInt" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.ArrayEqualsFixture.ArraysOfDouble" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.ArrayEqualsFixture.ArraysOfDecimal" executed="True" success="True" time="0.010" asserts="1" /> - <test-case name="NUnit.Framework.Tests.ArrayEqualsFixture.ArrayOfIntVersusArrayOfDouble" executed="True" success="True" time="0.000" asserts="2" /> - <test-case name="NUnit.Framework.Tests.ArrayEqualsFixture.RanksOfArraysMustMatch" executed="True" success="True" time="0.000" asserts="2" /> - <test-case name="NUnit.Framework.Tests.ArrayEqualsFixture.MultiDimensionedArraysNotSupported" executed="True" success="True" time="0.020" asserts="1" /> - <test-case name="NUnit.Framework.Tests.ArrayEqualsFixture.ArraysPassedAsObjects" executed="True" success="True" time="0.000" asserts="2" /> + <test-case name="NUnit.Framework.Constraints.Tests.AllItemsTests.AllItemsAreInRange" executed="True" success="True" time="0.000" asserts="1" /> + <test-case name="NUnit.Framework.Constraints.Tests.AllItemsTests.AllItemsAreInRangeFailureMessage" executed="True" success="True" time="0.016" asserts="2" /> + <test-case name="NUnit.Framework.Constraints.Tests.AllItemsTests.AllItemsAreInstancesOfType" executed="True" success="True" time="0.000" asserts="1" /> + <test-case name="NUnit.Framework.Constraints.Tests.AllItemsTests.AllItemsAreInstancesOfTypeFailureMessage" executed="True" success="True" time="0.000" asserts="2" /> + <test-case name="NUnit.Framework.Constraints.Tests.AllItemsTests.AllItemsAreNotNull" executed="True" success="True" time="0.000" asserts="1" /> + <test-case name="NUnit.Framework.Constraints.Tests.AllItemsTests.AllItemsAreNotNullFails" executed="True" success="True" time="0.000" asserts="2" /> </results> </test-suite> - <test-suite name="AssertExtensionTests" success="True" time="0.030" asserts="0"> + <test-suite name="AndTest" success="True" time="0.016" asserts="0"> <results> - <test-case name="NUnit.Framework.Tests.AssertExtensionTests.FormattedMessageTests" executed="True" success="True" time="0.020" asserts="6" /> - <test-case name="NUnit.Framework.Tests.AssertExtensionTests.OddNumber" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.AssertExtensionTests.OddNumberFails" executed="True" success="True" time="0.000" asserts="1" /> + <test-case name="NUnit.Framework.Constraints.Tests.AndTest.CanCombineTestsWithAndOperator" executed="True" success="True" time="0.000" asserts="1" /> + <test-case name="NUnit.Framework.Constraints.Tests.AndTest.FailsOnBadValues" executed="True" success="True" time="0.000" asserts="2" /> + <test-case name="NUnit.Framework.Constraints.Tests.AndTest.ProvidesProperDescription" executed="True" success="True" time="0.000" asserts="1" /> + <test-case name="NUnit.Framework.Constraints.Tests.AndTest.ProvidesProperFailureMessage" executed="True" success="True" time="0.016" asserts="3" /> + <test-case name="NUnit.Framework.Constraints.Tests.AndTest.SucceedsOnGoodValues" executed="True" success="True" time="0.000" asserts="1" /> </results> </test-suite> - <test-suite name="ConditionAssertTests" success="True" time="0.020" asserts="0"> + <test-suite name="AssignableFromTest" success="True" time="0.000" asserts="0"> <results> - <test-case name="NUnit.Framework.Tests.ConditionAssertTests.IsTrue" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.ConditionAssertTests.IsTrueFails" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.ConditionAssertTests.IsFalse" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.ConditionAssertTests.IsFalseFails" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.ConditionAssertTests.IsNull" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.ConditionAssertTests.IsNullFails" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.ConditionAssertTests.IsNotNull" executed="True" success="True" time="0.010" asserts="1" /> - <test-case name="NUnit.Framework.Tests.ConditionAssertTests.IsNotNullFails" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.ConditionAssertTests.IsNaN" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.ConditionAssertTests.IsNaNFails" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.ConditionAssertTests.IsEmpty" executed="True" success="True" time="0.000" asserts="4" /> - <test-case name="NUnit.Framework.Tests.ConditionAssertTests.IsEmptyFailsOnString" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.ConditionAssertTests.IsEmptyFailsOnNullString" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.ConditionAssertTests.IsEmptyFailsOnNonEmptyArray" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.ConditionAssertTests.IsNotEmpty" executed="True" success="True" time="0.010" asserts="4" /> - <test-case name="NUnit.Framework.Tests.ConditionAssertTests.IsNotEmptyFailsOnEmptyString" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.ConditionAssertTests.IsNotEmptyFailsOnEmptyArray" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.ConditionAssertTests.IsNotEmptyFailsOnEmptyArrayList" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.ConditionAssertTests.IsNotEmptyFailsOnEmptyHashTable" executed="True" success="True" time="0.000" asserts="1" /> + <test-case name="NUnit.Framework.Constraints.Tests.AssignableFromTest.FailsOnBadValues" executed="True" success="True" time="0.000" asserts="1" /> + <test-case name="NUnit.Framework.Constraints.Tests.AssignableFromTest.ProvidesProperDescription" executed="True" success="True" time="0.000" asserts="1" /> + <test-case name="NUnit.Framework.Constraints.Tests.AssignableFromTest.ProvidesProperFailureMessage" executed="True" success="True" time="0.000" asserts="3" /> + <test-case name="NUnit.Framework.Constraints.Tests.AssignableFromTest.SucceedsOnGoodValues" executed="True" success="True" time="0.000" asserts="2" /> </results> </test-suite> - <test-suite name="EqualsFixture" success="True" time="0.250" asserts="0"> + <test-suite name="CollectionContainsTests" success="True" time="0.000" asserts="0"> <results> - <test-case name="NUnit.Framework.Tests.EqualsFixture.Equals" executed="True" success="True" time="0.010" asserts="2" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.EqualsNull" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.Bug575936Int32Int64Comparison" executed="True" success="True" time="0.010" asserts="1" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.IntegerLongComparison" executed="True" success="True" time="0.000" asserts="2" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.IntergerEquals" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.EqualsFail" executed="True" success="True" time="0.000" asserts="2" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.EqualsNaNFails" executed="True" success="True" time="0.010" asserts="1" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.NanEqualsFails" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.NanEqualsNaNSucceeds" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.NegInfinityEqualsInfinity" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.PosInfinityEqualsInfinity" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.PosInfinityNotEquals" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.PosInfinityNotEqualsNegInfinity" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.SinglePosInfinityNotEqualsNegInfinity" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.EqualsThrowsException" executed="True" success="True" time="0.000" asserts="0" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.ReferenceEqualsThrowsException" executed="True" success="True" time="0.000" asserts="0" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.Float" executed="True" success="True" time="0.000" asserts="2" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.Byte" executed="True" success="True" time="0.000" asserts="2" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.String" executed="True" success="True" time="0.000" asserts="2" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.Short" executed="True" success="True" time="0.030" asserts="2" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.Int" executed="True" success="True" time="0.000" asserts="2" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.Decimal" executed="True" success="True" time="0.000" asserts="2" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.EqualsSameTypes" executed="True" success="True" time="0.000" asserts="21" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.EnumsEqual" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.EnumsNotEqual" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.DateTimeEqual" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.EqualsFixture.DateTimeNotEqual" executed="True" success="True" time="0.030" asserts="1" /> + <test-case name="NUnit.Framework.Constraints.Tests.CollectionContainsTests.CanTestContentsOfArray" executed="True" success="True" time="0.000" asserts="1" /> + <test-case name="NUnit.Framework.Constraints.Tests.CollectionContainsTests.CanTestContentsOfArrayList" executed="True" success="True" time="0.000" asserts="1" /> + <test-case name="NUnit.Framework.Constraints.Tests.CollectionContainsTests.CanTestContentsOfSortedList" executed="True" success="True" time="0.000" asserts="2" /> </results> </test-suite> - <test-suite name="MyAssertionFailureMessage+FailureMessageFixture" success="True" time="0.210" asserts="0"> + <test-suite name="EmptyTest" success="True" time="0.000" asserts="0"> <results> - <test-case name="NUnit.Framework.Tests.MyAssertionFailureMessage+FailureMessageFixture.TestInputsAreStrings" executed="True" success="True" time="0.010" asserts="8" /> - <test-case name="NUnit.Framework.Tests.MyAssertionFailureMessage+FailureMessageFixture.TestCreateStringBuilder" executed="True" success="True" time="0.000" asserts="5" /> - <test-case name="NUnit.Framework.Tests.MyAssertionFailureMessage+FailureMessageFixture.TestClipAroundPosition" executed="True" success="True" time="0.000" asserts="26" /> - <test-case name="NUnit.Framework.Tests.MyAssertionFailureMessage+FailureMessageFixture.TestClipAroundPosition2" executed="True" success="True" time="0.000" asserts="80" /> - <test-case name="NUnit.Framework.Tests.MyAssertionFailureMessage+FailureMessageFixture.TestConvertWhitespace" executed="True" success="True" time="0.000" asserts="13" /> - <test-case name="NUnit.Framework.Tests.MyAssertionFailureMessage+FailureMessageFixture.TestFormatMessageForFailNotEquals" executed="True" success="True" time="0.030" asserts="13" /> - <test-case name="NUnit.Framework.Tests.MyAssertionFailureMessage+FailureMessageFixture.TestFormatMessageForFailNotEqualsIgnoringCase" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.MyAssertionFailureMessage+FailureMessageFixture.TestFormatMessageForFailNotEqualsNewlines" executed="True" success="True" time="0.000" asserts="3" /> - <test-case name="NUnit.Framework.Tests.MyAssertionFailureMessage+FailureMessageFixture.TestStringLengthsDiffer" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.MyAssertionFailureMessage+FailureMessageFixture.TestStringLengthsDiffer2" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.MyAssertionFailureMessage+FailureMessageFixture.TestStringLengthsDiffer3" executed="True" success="True" time="0.140" asserts="995" /> - <test-case name="NUnit.Framework.Tests.MyAssertionFailureMessage+FailureMessageFixture.DisplayListElements" executed="True" success="True" time="0.010" asserts="6" /> - <test-case name="NUnit.Framework.Tests.MyAssertionFailureMessage+FailureMessageFixture.TestFormatMessageForArraysNotEqual" executed="True" success="True" time="0.000" asserts="4" /> + <test-case name="NUnit.Framework.Constraints.Tests.EmptyTest.FailsOnBadValues" executed="True" success="True" time="0.000" asserts="2" /> + <test-case name="NUnit.Framework.Constraints.Tests.EmptyTest.ProvidesProperDescription" executed="True" success="True" time="0.000" asserts="1" /> + <test-case name="NUnit.Framework.Constraints.Tests.EmptyTest.ProvidesProperFailureMessage" executed="True" success="True" time="0.000" asserts="3" /> + <test-case name="NUnit.Framework.Constraints.Tests.EmptyTest.SucceedsOnGoodValues" executed="True" success="True" time="0.000" asserts="3" /> </results> </test-suite> - <test-suite name="GreaterFixture" success="True" time="0.611" asserts="0"> + <test-suite name="EndsWithTest" success="True" time="0.000" asserts="0"> <results> - <test-case name="NUnit.Framework.Tests.GreaterFixture.Greater" executed="True" success="True" time="0.000" asserts="4" /> - <test-case name="NUnit.Framework.Tests.GreaterFixture.NotGreaterWhenEqual" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.GreaterFixture.NotGreater" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.GreaterFixture.NotGreaterIComparable" executed="True" success="True" time="0.020" asserts="1" /> - <test-case name="NUnit.Framework.Tests.GreaterFixture.FailureMessage" executed="True" success="True" time="0.010" asserts="3" /> + <test-case name="NUnit.Framework.Constraints.Tests.EndsWithTest.FailsOnBadValues" executed="True" success="True" time="0.000" asserts="6" /> + <test-case name="NUnit.Framework.Constraints.Tests.EndsWithTest.ProvidesProperDescription" executed="True" success="True" time="0.000" asserts="1" /> + <test-case name="NUnit.Framework.Constraints.Tests.EndsWithTest.ProvidesProperFailureMessage" executed="True" success="True" time="0.000" asserts="3" /> + <test-case name="NUnit.Framework.Constraints.Tests.EndsWithTest.SucceedsOnGoodValues" executed="True" success="True" time="0.000" asserts="2" /> </results> </test-suite> - <test-suite name="LessFixture" success="True" time="0.030" asserts="0"> + <test-suite name="EndsWithTestIgnoringCase" success="True" time="0.000" asserts="0"> <results> - <test-case name="NUnit.Framework.Tests.LessFixture.Less" executed="True" success="True" time="0.000" asserts="12" /> - <test-case name="NUnit.Framework.Tests.LessFixture.NotLessWhenEqual" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.LessFixture.NotLess" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.LessFixture.NotLessIComparable" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.LessFixture.FailureMessage" executed="True" success="True" time="0.000" asserts="3" /> + <test-case name="NUnit.Framework.Constraints.Tests.EndsWithTestIgnoringCase.FailsOnBadValues" executed="True" success="True" time="0.000" asserts="6" /> + <test-case name="NUnit.Framework.Constraints.Tests.EndsWithTestIgnoringCase.ProvidesProperDescription" executed="True" success="True" time="0.000" asserts="1" /> + <test-case name="NUnit.Framework.Constraints.Tests.EndsWithTestIgnoringCase.ProvidesProperFailureMessage" executed="True" success="True" time="0.000" asserts="3" /> + <test-case name="NUnit.Framework.Constraints.Tests.EndsWithTestIgnoringCase.SucceedsOnGoodValues" executed="True" success="True" time="0.000" asserts="2" /> </results> </test-suite> - <test-suite name="ListContentsTests" success="True" time="0.010" asserts="0"> + <test-suite name="EqualIgnoringCaseTest" success="True" time="0.000" asserts="0"> <results> - <test-case name="NUnit.Framework.Tests.ListContentsTests.ArraySucceeds" executed="True" success="True" time="0.000" asserts="3" /> - <test-case name="NUnit.Framework.Tests.ListContentsTests.ArrayFails" executed="True" success="True" time="0.000" asserts="2" /> - <test-case name="NUnit.Framework.Tests.ListContentsTests.EmptyArrayFails" executed="True" success="True" time="0.000" asserts="2" /> - <test-case name="NUnit.Framework.Tests.ListContentsTests.NullArrayFails" executed="True" success="True" time="0.000" asserts="2" /> - <test-case name="NUnit.Framework.Tests.ListContentsTests.ArrayListSucceeds" executed="True" success="True" time="0.000" asserts="3" /> - <test-case name="NUnit.Framework.Tests.ListContentsTests.ArrayListFails" executed="True" success="True" time="0.000" asserts="2" /> - <test-case name="NUnit.Framework.Tests.ListContentsTests.DifferentTypesFail" executed="True" success="True" time="0.000" asserts="2" /> + <test-case name="NUnit.Framework.Constraints.Tests.EqualIgnoringCaseTest.FailsOnBadValues" executed="True" success="True" time="0.000" asserts="4" /> + <test-case name="NUnit.Framework.Constraints.Tests.EqualIgnoringCaseTest.ProvidesProperDescription" executed="True" success="True" time="0.000" asserts="1" /> + <test-case name="NUnit.Framework.Constraints.Tests.EqualIgnoringCaseTest.ProvidesProperFailureMessage" executed="True" success="True" time="0.000" asserts="3" /> + <test-case name="NUnit.Framework.Constraints.Tests.EqualIgnoringCaseTest.SucceedsOnGoodValues" executed="True" success="True" time="0.000" asserts="3" /> </results> </test-suite> - <test-suite name="NotEqualFixture" success="True" time="0.010" asserts="0"> + <test-suite name="EqualTest" success="True" time="0.047" asserts="0"> <results> - <test-case name="NUnit.Framework.Tests.NotEqualFixture.NotEqual" executed="True" success="True" time="0.010" asserts="1" /> - <test-case name="NUnit.Framework.Tests.NotEqualFixture.NotEqualFails" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.NotEqualFixture.NullNotEqualToNonNull" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.NotEqualFixture.NullEqualsNull" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.NotEqualFixture.ArraysNotEqual" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.NotEqualFixture.ArraysNotEqualFails" executed="True" success="True" time="0.000" asserts="1" /> + <test-case name="NUnit.Framework.Constraints.Tests.EqualTest.FailedStringMatchShowsFailurePosition" executed="True" success="True" time="0.000" asserts="2" /> + <test-case name="NUnit.Framework.Constraints.Tests.EqualTest.FailsOnBadValues" executed="True" success="True" time="0.000" asserts="3" /> + <test-case name="NUnit.Framework.Constraints.Tests.EqualTest.LongStringsAreTruncated" executed="True" success="True" time="0.031" asserts="2" /> + <test-case name="NUnit.Framework.Constraints.Tests.EqualTest.LongStringsAreTruncatedAtBothEndsIfNecessary" executed="True" success="True" time="0.000" asserts="2" /> + <test-case name="NUnit.Framework.Constraints.Tests.EqualTest.LongStringsAreTruncatedAtFrontEndIfNecessary" executed="True" success="True" time="0.000" asserts="2" /> + <test-case name="NUnit.Framework.Constraints.Tests.EqualTest.NANsCompareAsEqual" executed="True" success="True" time="0.000" asserts="1" /> + <test-case name="NUnit.Framework.Constraints.Tests.EqualTest.ProvidesProperDescription" executed="True" success="True" time="0.000" asserts="1" /> + <test-case name="NUnit.Framework.Constraints.Tests.EqualTest.ProvidesProperFailureMessage" executed="True" success="True" time="0.000" asserts="3" /> + <test-case name="NUnit.Framework.Constraints.Tests.EqualTest.SucceedsOnGoodValues" executed="True" success="True" time="0.000" asserts="4" /> </results> </test-suite> - <test-suite name="NotSameFixture" success="True" time="0.100" asserts="0"> + <test-suite name="ExactTypeTest" success="True" time="0.000" asserts="0"> <results> - <test-case name="NUnit.Framework.Tests.NotSameFixture.NotSame" executed="True" success="True" time="0.020" asserts="1" /> - <test-case name="NUnit.Framework.Tests.NotSameFixture.NotSameFails" executed="True" success="True" time="0.000" asserts="1" /> + <test-case name="NUnit.Framework.Constraints.Tests.ExactTypeTest.FailsOnBadValues" executed="True" success="True" time="0.000" asserts="2" /> + <test-case name="NUnit.Framework.Constraints.Tests.ExactTypeTest.ProvidesProperDescription" executed="True" success="True" time="0.000" asserts="1" /> + <test-case name="NUnit.Framework.Constraints.Tests.ExactTypeTest.ProvidesProperFailureMessage" executed="True" success="True" time="0.000" asserts="3" /> + <test-case name="NUnit.Framework.Constraints.Tests.ExactTypeTest.SucceedsOnGoodValues" executed="True" success="True" time="0.000" asserts="1" /> </results> </test-suite> - <test-suite name="SameFixture" success="True" time="0.010" asserts="0"> + <test-suite name="GreaterThanOrEqualTest" success="True" time="0.000" asserts="0"> <results> - <test-case name="NUnit.Framework.Tests.SameFixture.Same" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.SameFixture.SameFails" executed="True" success="True" time="0.000" asserts="1" /> - <test-case name="NUnit.Framework.Tests.SameFixture.SameValueTypes" executed="True" success="True" time="0.000" asserts="1" /> + <test-case name="NUnit.Framework.Constraints.Tests.GreaterThanOrEqualTest.FailsOnBadValues" executed="True" success="True" time="0.000" asserts="3" /> + <test-case name="NUnit.Framework.Constraints.Tests.GreaterThanOrEqualTest.ProvidesProperDescription" executed="True" success="True" time="0.000" asserts="1" /> + <test-case name="NUnit.Framework.Constraints.Tests.GreaterThanOrEqualTest.ProvidesProperFailureMessage" executed="True" success="True" time="0.000" asserts="3" /> + <test-case name="NUnit.Framework.Constraints.Tests.GreaterThanOrEqualTest.SucceedsOnGoodValues" executed="True" success="True" time="0.000" asserts="2" /> </results> </test-suite> - <test-suite name="StringAssertTests" success="True" time="0.050" asserts="0"> + <test-suite name="GreaterThanTest" success="True" time="0.000" asserts="0"> <results> - <test-case name="NUnit.Framework.Tests.StringAssertTests.Contains" executed="True" success="True" time="0.000" asserts="3" /> - <test-case name="NUnit.Framework.Tests.StringAssertTests.ContainsFails" executed="True" success="True" time="0.000" asserts="2" /> - <test-case name="NUnit.Framework.Tests.StringAssertTests.StartsWith" executed="True" success="True" time="0.000" asserts="2" /> - <test-case name="NUnit.Framework.Tests.StringAssertTests.StartsWithFails" executed="True" success="True" time="0.000" asserts="2" /> - <test-case name="NUnit.Framework.Tests.StringAssertTests.EndsWith" executed="True" success="True" time="0.000" asserts="2" /> - <test-case name="NUnit.Framework.Tests.StringAssertTests.EndsWithFails" executed="True" success="True" time="0.000" asserts="2" /> - <test-case name="NUnit.Framework.Tests.StringAssertTests.CaseInsensitiveCompare" executed="True" success="True" time="0.030" asserts="1" /> - <test-case name="NUnit.Framework.Tests.StringAssertTests.CaseInsensitiveCompareFails" executed="True" success="True" time="0.010" asserts="2" /> + <test-case name="NUnit.Framework.Constraints.Tests.GreaterThanTest.FailsOnBadValues" executed="True" success="True" time="0.000" asserts="4" /> + <test-case name="NUnit.Framework.Constraints.Tests.GreaterThanTest.ProvidesProperDescription" executed="True" success="True" time="0.000" asserts="1" /> + <test-case name="NUnit.Framework.Constraints.Tests.GreaterThanTest.ProvidesProperFailureMessage" executed="True" success="True" time="0.000" asserts="3" /> + <test-case name="NUnit.Framework.Constraints.Tests.GreaterThanTest.SucceedsOnGoodValues" executed="True" success="True" time="0.000" asserts="1" /> </results> </test-suite> - <test-suite name="TypeAssertTests" success="True" time="0.140" asserts="0"> + <test-suite name="InstanceOfTypeTest" success="True" ... [truncated message content] |
From: <fli...@us...> - 2007-05-01 02:17:26
|
Revision: 44 http://structuremap.svn.sourceforge.net/structuremap/?rev=44&view=rev Author: flimflan Date: 2007-04-30 19:17:17 -0700 (Mon, 30 Apr 2007) Log Message: ----------- Implemented PullConfigurationFromAppConfig. Created ObjectFactory.ReInitialize() to allow more isolated unit tests. Modified Paths: -------------- trunk/Source/StructureMap/Configuration/StructureMapConfigurationSection.cs trunk/Source/StructureMap/ObjectFactory.cs trunk/Source/StructureMap/StructureMapConfiguration.cs trunk/Source/StructureMap/StructureMapException.resx trunk/Source/StructureMap.Testing/AlternativeConfigurationTester.cs trunk/Source/StructureMap.Testing/StructureMapConfigurationTester.cs trunk/cruise.build Property Changed: ---------------- trunk/Source/ trunk/Source/StructureMap.DataAccess/ trunk/Source/StructureMap.Testing.GenericWidgets/ Property changes on: trunk/Source ___________________________________________________________________ Name: svn:ignore - *.suo + *.suo _ReSharper.StructureMap PrecompiledWeb *.resharper *.user Modified: trunk/Source/StructureMap/Configuration/StructureMapConfigurationSection.cs =================================================================== --- trunk/Source/StructureMap/Configuration/StructureMapConfigurationSection.cs 2007-04-27 21:54:32 UTC (rev 43) +++ trunk/Source/StructureMap/Configuration/StructureMapConfigurationSection.cs 2007-05-01 02:17:17 UTC (rev 44) @@ -5,28 +5,27 @@ { public class StructureMapConfigurationSection : IConfigurationSectionHandler { - private XmlNode _node; - public object Create(object parent, object configContext, XmlNode section) { - return _node; + XmlNode parentNode = parent as XmlNode; + if (parentNode == null) return section; + // Might need to make this more intelligent, to merge nodes that override eachother + foreach (XmlNode childNode in section.ChildNodes) + { + XmlNode importedNode = parentNode.OwnerDocument.ImportNode(childNode, true); + parentNode.AppendChild(importedNode); + } + return parentNode; } public static XmlNode GetStructureMapConfiguration() { - object config = ConfigurationManager.GetSection(XmlConstants.STRUCTUREMAP); - - - return null; - /* - object o = ConfigurationSettings.GetConfig(XmlConstants.STRUCTUREMAP); - XmlNode node = o as XmlNode; + XmlNode node = ConfigurationSettings.GetConfig(XmlConstants.STRUCTUREMAP) as XmlNode; if (node == null) { - throw new ApplicationException("No <StructureMap> section was found in the application config file"); + throw new StructureMapException(105, XmlConstants.STRUCTUREMAP); } return node; - */ } } } \ No newline at end of file Modified: trunk/Source/StructureMap/ObjectFactory.cs =================================================================== --- trunk/Source/StructureMap/ObjectFactory.cs 2007-04-27 21:54:32 UTC (rev 43) +++ trunk/Source/StructureMap/ObjectFactory.cs 2007-05-01 02:17:17 UTC (rev 44) @@ -27,6 +27,16 @@ ObjectFactoryCacheCallback callback = new ObjectFactoryCacheCallback(); } + /// <summary> + /// Used for testing only (kills singletons). In non-test scenarios, use Reset() instead. + /// </summary> + public static void ReInitialize() + { + _profile = string.Empty; + _notify = null; + _manager = null; + } + #region InstanceManager and setting defaults private static InstanceManager manager Modified: trunk/Source/StructureMap/StructureMapConfiguration.cs =================================================================== --- trunk/Source/StructureMap/StructureMapConfiguration.cs 2007-04-27 21:54:32 UTC (rev 43) +++ trunk/Source/StructureMap/StructureMapConfiguration.cs 2007-05-01 02:17:17 UTC (rev 44) @@ -12,9 +12,9 @@ public static class StructureMapConfiguration { private const string CONFIG_FILE_NAME = "StructureMap.config"; - private static ConfigurationParserCollection _collection = new ConfigurationParserCollection(); - private static Registry _registry = new Registry(); - private static List<Registry> _registries = new List<Registry>(); + private static ConfigurationParserCollection _collection; + private static Registry _registry; + private static List<Registry> _registries; private static StartUp _startUp; private static bool _pullConfigurationFromAppConfig; @@ -58,6 +58,7 @@ _registries = new List<Registry>(); _registries.Add(_registry); _startUp = null; + _pullConfigurationFromAppConfig = false; } /// <summary> @@ -138,15 +139,10 @@ set { _collection.UseDefaultFile = value; } } - [Obsolete("Not ready yet")] public static bool PullConfigurationFromAppConfig { get { return _pullConfigurationFromAppConfig; } - set - { - throw new NotImplementedException("This feature has not been completed"); - _pullConfigurationFromAppConfig = value; - } + set { _pullConfigurationFromAppConfig = value; } } /// <summary> Modified: trunk/Source/StructureMap/StructureMapException.resx =================================================================== --- trunk/Source/StructureMap/StructureMapException.resx 2007-04-27 21:54:32 UTC (rev 43) +++ trunk/Source/StructureMap/StructureMapException.resx 2007-05-01 02:17:17 UTC (rev 44) @@ -246,4 +246,7 @@ <data name="305" xml:space="preserve"> <value>There is no constructor property found of type {0}</value> </data> + <data name="105" xml:space="preserve"> + <value>The <{0}> section could not be loaded from the application configuration file.</value> + </data> </root> \ No newline at end of file Property changes on: trunk/Source/StructureMap.DataAccess ___________________________________________________________________ Name: svn:ignore + bin obj Modified: trunk/Source/StructureMap.Testing/AlternativeConfigurationTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/AlternativeConfigurationTester.cs 2007-04-27 21:54:32 UTC (rev 43) +++ trunk/Source/StructureMap.Testing/AlternativeConfigurationTester.cs 2007-05-01 02:17:17 UTC (rev 44) @@ -12,6 +12,7 @@ [SetUp] public void SetUp() { + ObjectFactory.ReInitialize(); StructureMapConfiguration.ResetAll(); DataMother.WriteDocument("Config1.xml"); DataMother.WriteDocument("Config2.xml"); Modified: trunk/Source/StructureMap.Testing/StructureMapConfigurationTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/StructureMapConfigurationTester.cs 2007-04-27 21:54:32 UTC (rev 43) +++ trunk/Source/StructureMap.Testing/StructureMapConfigurationTester.cs 2007-05-01 02:17:17 UTC (rev 44) @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Xml; using NUnit.Framework; using StructureMap.Configuration; using StructureMap.Graph; @@ -13,6 +14,7 @@ [SetUp] public void SetUp() { + ObjectFactory.ReInitialize(); StructureMapConfiguration.ResetAll(); } @@ -31,8 +33,7 @@ } [Test, - ExpectedException(typeof (ApplicationException), - "StructureMap detected configuration or environmental problems. Check the StructureMap error file")] + ExpectedException(typeof(ApplicationException), ExpectedMessage = "StructureMap detected configuration or environmental problems. Check the StructureMap error file")] public void OnStartUpFail() { StructureMapConfiguration.OnStartUp().FailOnException(); @@ -77,7 +78,7 @@ } - [Test, Ignore("Not complete")] + [Test] public void PullConfigurationFromTheAppConfig() { StructureMapConfiguration.UseDefaultStructureMapConfigFile = false; @@ -87,6 +88,37 @@ (ColorThing<string, bool>) ObjectFactory.GetInstance<IThing<string, bool>>(); Assert.AreEqual("Cornflower", thing.Color, "Cornflower is the color from the App.config file"); } + + [Test] + public void AppConfigShouldIncludeSettingsFromParentConfig() + { + StructureMapConfigurationSection configurationSection = new StructureMapConfigurationSection(); + + XmlNode fromMachineConfig = createNodeFromText(@"<StructureMap><Assembly Name=""SomeAssembly""/></StructureMap>"); + XmlNode fromWebConfig = createNodeFromText(@"<StructureMap><Assembly Name=""AnotherAssembly""/></StructureMap>"); + + XmlNode effectiveConfig = configurationSection.Create(fromMachineConfig, null, fromWebConfig) as XmlNode; + + Assert.IsNotNull(effectiveConfig, "A configuration node should have been returned."); + Assert.AreEqual(2, effectiveConfig.ChildNodes.Count, "Both Assembly entries should have been returned."); + Assert.IsTrue(hasAttributeValue("Name", "SomeAssembly", effectiveConfig.ChildNodes[0]), "The parent Assembly entry should have been returned first."); + Assert.IsTrue(hasAttributeValue("Name", "AnotherAssembly", effectiveConfig.ChildNodes[1]), "The child Assembly entry should have been returned second."); + + } + + private static XmlNode createNodeFromText(string outerXml) + { + XmlDocument document = new XmlDocument(); + document.LoadXml(outerXml); + return document.DocumentElement; + } + + private static bool hasAttributeValue(string attributeName, string attributeValue, XmlNode node) + { + XmlAttribute namedAttribute = node.Attributes[attributeName]; + if (namedAttribute == null) return false; + return namedAttribute.Value == attributeValue; + } } public interface ISomething @@ -100,4 +132,6 @@ throw new ApplicationException("You can't make me!"); } } + + } \ No newline at end of file Property changes on: trunk/Source/StructureMap.Testing.GenericWidgets ___________________________________________________________________ Name: svn:ignore + obj Modified: trunk/cruise.build =================================================================== --- trunk/cruise.build 2007-04-27 21:54:32 UTC (rev 43) +++ trunk/cruise.build 2007-05-01 02:17:17 UTC (rev 44) @@ -71,7 +71,7 @@ <include name="**\bin\${project.config}\*.exe" /> <include name="**\bin\${project.config}\*.xml" /> <include name="**\bin\${project.config}\*.xml.actual" /> - <include name="StructureMap.Testing\StructureMap.config" /> + <include name="StructureMap.Testing\*.config" /> </fileset> </copy> <copy todir="${build.dir}\..\" flatten="true" overwrite="true"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2007-12-22 17:45:22
|
Revision: 50 http://structuremap.svn.sourceforge.net/structuremap/?rev=50&view=rev Author: jeremydmiller Date: 2007-12-22 09:45:18 -0800 (Sat, 22 Dec 2007) Log Message: ----------- shortcuts for <AddInstance> to simplify Xml configuration, interceptors and enrichment at both the Instance and PluginType level. The very beginnings of an AutoMocking approach with RhinoMocks Modified Paths: -------------- trunk/AssembliesBuildOrder.xml trunk/AssembliesDependencies.xml trunk/AssembliesMetrics.xml trunk/ComponentDependenciesDiagram.png trunk/Source/CommonAssemblyInfo.cs trunk/Source/StructureMap/Configuration/ConfigurationParser.cs trunk/Source/StructureMap/Configuration/DSL/CreatePluginFamilyExpression.cs trunk/Source/StructureMap/Configuration/DSL/InstanceExpression.cs trunk/Source/StructureMap/Configuration/DSL/LiteralMemento.cs trunk/Source/StructureMap/Configuration/DSL/MementoBuilder.cs trunk/Source/StructureMap/Configuration/DSL/PrototypeMemento.cs trunk/Source/StructureMap/Configuration/DSL/Registry.cs trunk/Source/StructureMap/Configuration/FamilyParser.cs trunk/Source/StructureMap/Configuration/UserControlMemento.cs trunk/Source/StructureMap/Configuration/XmlConstants.cs trunk/Source/StructureMap/ConstructorMemento.cs trunk/Source/StructureMap/Graph/PluginFamily.cs trunk/Source/StructureMap/IInstanceManager.cs trunk/Source/StructureMap/InstanceFactory.cs trunk/Source/StructureMap/InstanceManager.cs trunk/Source/StructureMap/InstanceMemento.cs trunk/Source/StructureMap/Source/XmlAttributeInstanceMemento.cs trunk/Source/StructureMap/StructureMap.csproj trunk/Source/StructureMap/StructureMapConfiguration.cs trunk/Source/StructureMap/StructureMapException.resx trunk/Source/StructureMap.Testing/Configuration/DSL/ConstructorExpressionTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs trunk/Source/StructureMap.Testing/Configuration/DefaultInstanceNodeTester.cs trunk/Source/StructureMap.Testing/Container/InstanceFactoryTester.cs trunk/Source/StructureMap.Testing/Graph/PluginFamilyTester.cs trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj trunk/Source/StructureMap.Testing.Widget3/IService.cs trunk/Source/StructureMap.sln trunk/TypesDependencies.xml trunk/TypesMetrics.xml Added Paths: ----------- trunk/Source/StructureMap/Configuration/DSL/ChildArrayExpression.cs trunk/Source/StructureMap/Configuration/DSL/ReferenceMementoBuilder.cs trunk/Source/StructureMap/Delegates.cs trunk/Source/StructureMap.AutoMocking/ trunk/Source/StructureMap.AutoMocking/AutoMockedInstanceManager.cs trunk/Source/StructureMap.AutoMocking/Properties/ trunk/Source/StructureMap.AutoMocking/Properties/AssemblyInfo.cs trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs trunk/Source/StructureMap.AutoMocking/StructureMap.AutoMocking.csproj trunk/Source/StructureMap.Testing/AutoMocking/ trunk/Source/StructureMap.Testing/AutoMocking/RhinoAutoMockerTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/InjectArrayTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/InterceptAllInstancesOfPluginTypeTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/InterceptorTesting.cs trunk/Source/StructureMap.Testing/Configuration/DSL/ReferenceMementoBuilderTester.cs trunk/Source/StructureMap.Testing/Configuration/ShortcuttedInstanceNodeTester.cs trunk/Source/StructureMap.Testing/InstanceMementoTester.cs trunk/Source/StructureMap.Testing/TestData/ShortInstance.xml Modified: trunk/AssembliesBuildOrder.xml =================================================================== --- trunk/AssembliesBuildOrder.xml 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/AssembliesBuildOrder.xml 2007-12-22 17:45:18 UTC (rev 50) @@ -1,6 +1,2 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> -<AssemblySortForCompilOrObfusk> - <Assembly Name="StructureMap">1</Assembly> - <Assembly Name="StructureMap.DeploymentTasks">2</Assembly> - <Assembly Name="StructureMap.Client">3</Assembly> -</AssemblySortForCompilOrObfusk> \ No newline at end of file +<AssemblySortForCompilOrObfusk /> \ No newline at end of file Modified: trunk/AssembliesDependencies.xml =================================================================== --- trunk/AssembliesDependencies.xml 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/AssembliesDependencies.xml 2007-12-22 17:45:18 UTC (rev 50) @@ -1,24 +1,2 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> -<AssemblyDependencies> - <Dependencies_For Assembly="StructureMap"> - <DependsOn> - <DependsOn_Name>nmock</DependsOn_Name> - </DependsOn> - <ReferencedBy> - <ReferencedBy_Name>StructureMap.DeploymentTasks</ReferencedBy_Name> - <ReferencedBy_Name>StructureMap.Client</ReferencedBy_Name> - </ReferencedBy> - </Dependencies_For> - <Dependencies_For Assembly="StructureMap.DeploymentTasks"> - <DependsOn> - <DependsOn_Name>nant.core</DependsOn_Name> - <DependsOn_Name>StructureMap</DependsOn_Name> - </DependsOn> - </Dependencies_For> - <Dependencies_For Assembly="StructureMap.Client"> - <DependsOn> - <DependsOn_Name>StructureMap</DependsOn_Name> - <DependsOn_Name>AxInterop.SHDocVw</DependsOn_Name> - </DependsOn> - </Dependencies_For> -</AssemblyDependencies> \ No newline at end of file +<AssemblyDependencies /> \ No newline at end of file Modified: trunk/AssembliesMetrics.xml =================================================================== --- trunk/AssembliesMetrics.xml 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/AssembliesMetrics.xml 2007-12-22 17:45:18 UTC (rev 50) @@ -1,6 +1,2 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> -<AssembliesMetrics> - <Assembly Assembly="StructureMap" NTypes="147" NAbstractTypes="26" NILInstructionInAsm="18779" AfferentCoupling="60" EfferentCoupling="2" RelationalCohesion="4.69" Instability="0.03" Abstractness="0.18" DistFrMainSeq="0.56" NormDistFrMainSeq="0.79" /> - <Assembly Assembly="StructureMap.DeploymentTasks" NTypes="14" NAbstractTypes="1" NILInstructionInAsm="1661" AfferentCoupling="0" EfferentCoupling="18" RelationalCohesion="1" Instability="1" Abstractness="0.07" DistFrMainSeq="0.05" NormDistFrMainSeq="0.07" /> - <Assembly Assembly="StructureMap.Client" NTypes="30" NAbstractTypes="6" NILInstructionInAsm="2997" AfferentCoupling="0" EfferentCoupling="38" RelationalCohesion="1.93" Instability="1" Abstractness="0.2" DistFrMainSeq="0.14" NormDistFrMainSeq="0.2" /> -</AssembliesMetrics> \ No newline at end of file +<AssembliesMetrics /> \ No newline at end of file Modified: trunk/ComponentDependenciesDiagram.png =================================================================== (Binary files differ) Modified: trunk/Source/CommonAssemblyInfo.cs =================================================================== --- trunk/Source/CommonAssemblyInfo.cs 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/Source/CommonAssemblyInfo.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -5,7 +5,7 @@ //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. -// Runtime Version:2.0.50727.832 +// Runtime Version:2.0.50727.1433 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. Modified: trunk/Source/StructureMap/Configuration/ConfigurationParser.cs =================================================================== --- trunk/Source/StructureMap/Configuration/ConfigurationParser.cs 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/Source/StructureMap/Configuration/ConfigurationParser.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -179,6 +179,13 @@ { familyParser.ParseDefaultElement(element); } + + XmlNodeList instanceNodes = findNodes(XmlConstants.ADD_INSTANCE_NODE); + foreach (XmlElement element in instanceNodes) + { + familyParser.ParseInstanceElement(element); + } + } Added: trunk/Source/StructureMap/Configuration/DSL/ChildArrayExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/ChildArrayExpression.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/DSL/ChildArrayExpression.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -0,0 +1,50 @@ +using System; +using StructureMap.Graph; + +namespace StructureMap.Configuration.DSL +{ + public class ChildArrayExpression<PLUGINTYPE> : IExpression + { + private readonly InstanceExpression _parent; + private readonly MemoryInstanceMemento _memento; + private readonly string _propertyName; + private IMementoBuilder[] _builders; + private Type _pluginType = typeof (PLUGINTYPE); + + public ChildArrayExpression(InstanceExpression parent, MemoryInstanceMemento memento, string propertyName) + { + _parent = parent; + _memento = memento; + _propertyName = propertyName; + + _pluginType = typeof (PLUGINTYPE).GetElementType(); + } + + void IExpression.Configure(PluginGraph graph) + { + PluginFamily family = graph.LocateOrCreateFamilyForType(_pluginType); + InstanceMemento[] childMementos = new InstanceMemento[_builders.Length]; + for (int i = 0; i < _builders.Length; i++) + { + InstanceMemento memento = processMementoBuilder(_builders[i], family, graph); + childMementos[i] = memento; + } + + _memento.AddChildArray(_propertyName, childMementos); + } + + private InstanceMemento processMementoBuilder(IMementoBuilder builder, PluginFamily family, PluginGraph graph) + { + builder.ValidatePluggability(_pluginType); + builder.Configure(graph); + return builder.BuildMemento(family); + } + + public InstanceExpression Contains(params IMementoBuilder[] builders) + { + _builders = builders; + + return _parent; + } + } +} \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/DSL/CreatePluginFamilyExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/CreatePluginFamilyExpression.cs 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/Source/StructureMap/Configuration/DSL/CreatePluginFamilyExpression.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -11,16 +11,16 @@ /// <summary> /// Represents the parameters for creating instances of a given Type /// </summary> - public class CreatePluginFamilyExpression : IExpression + public class CreatePluginFamilyExpression<PLUGINTYPE> : IExpression { private Type _pluginType; private List<AlterPluginFamilyDelegate> _alterations = new List<AlterPluginFamilyDelegate>(); private InstanceScope _scope = InstanceScope.PerRequest; private List<IExpression> _children = new List<IExpression>(); - public CreatePluginFamilyExpression(Type pluginType) + public CreatePluginFamilyExpression() { - _pluginType = pluginType; + _pluginType = typeof(PLUGINTYPE); } void IExpression.Configure(PluginGraph graph) @@ -50,7 +50,7 @@ /// </summary> /// <param name="builder"></param> /// <returns></returns> - public CreatePluginFamilyExpression TheDefaultIs(IMementoBuilder builder) + public CreatePluginFamilyExpression<PLUGINTYPE> TheDefaultIs(IMementoBuilder builder) { builder.ValidatePluggability(_pluginType); @@ -65,7 +65,7 @@ return this; } - public CreatePluginFamilyExpression AddInstance(IMementoBuilder builder) + public CreatePluginFamilyExpression<PLUGINTYPE> AddInstance(IMementoBuilder builder) { builder.ValidatePluggability(_pluginType); @@ -86,7 +86,7 @@ /// </summary> /// <typeparam name="CONCRETETYPE"></typeparam> /// <returns></returns> - public CreatePluginFamilyExpression TheDefaultIsConcreteType<CONCRETETYPE>() + public CreatePluginFamilyExpression<PLUGINTYPE> TheDefaultIsConcreteType<CONCRETETYPE>() where CONCRETETYPE : PLUGINTYPE { ExpressionValidator.ValidatePluggabilityOf(typeof (CONCRETETYPE)).IntoPluginType(_pluginType); @@ -105,7 +105,7 @@ /// </summary> /// <param name="scope"></param> /// <returns></returns> - public CreatePluginFamilyExpression CacheBy(InstanceScope scope) + public CreatePluginFamilyExpression<PLUGINTYPE> CacheBy(InstanceScope scope) { _alterations.Add(delegate(PluginFamily family) { @@ -120,13 +120,32 @@ /// Convenience method to mark a PluginFamily as a Singleton /// </summary> /// <returns></returns> - public CreatePluginFamilyExpression AsSingletons() + public CreatePluginFamilyExpression<PLUGINTYPE> AsSingletons() { _alterations.Add( delegate(PluginFamily family) { family.InterceptionChain.AddInterceptor(new SingletonInterceptor()); }); return this; } - + + public CreatePluginFamilyExpression<PLUGINTYPE> OnCreation(StartupHandler<PLUGINTYPE> handler) + { + _alterations.Add(delegate (PluginFamily family) + { + family.InstanceInterceptor = new StartupInterceptor<PLUGINTYPE>(handler); + }); + + return this; + } + + public CreatePluginFamilyExpression<PLUGINTYPE> EnrichWith(EnrichmentHandler<PLUGINTYPE> handler) + { + _alterations.Add(delegate(PluginFamily family) + { + family.InstanceInterceptor = new EnrichmentInterceptor<PLUGINTYPE>(handler); + }); + + return this; + } } } \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/DSL/InstanceExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/InstanceExpression.cs 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/Source/StructureMap/Configuration/DSL/InstanceExpression.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -71,42 +71,44 @@ /// in the case of a constructor function that consumes more than one argument /// of type T /// </summary> - /// <typeparam name="T"></typeparam> + /// <typeparam name="CONSTRUCTORARGUMENTTYPE"></typeparam> /// <param name="propertyName"></param> /// <returns></returns> - public ChildInstanceExpression Child<T>(string propertyName) + public ChildInstanceExpression Child<CONSTRUCTORARGUMENTTYPE>(string propertyName) { ChildInstanceExpression child = new ChildInstanceExpression(this, _memento, propertyName); addChildExpression(child); - child.ChildType = typeof (T); + child.ChildType = typeof (CONSTRUCTORARGUMENTTYPE); return child; } /// <summary> - /// Start the definition of a child instance for type T + /// Start the definition of a child instance for type CONSTRUCTORARGUMENTTYPE /// </summary> - /// <typeparam name="T"></typeparam> + /// <typeparam name="CONSTRUCTORARGUMENTTYPE"></typeparam> /// <returns></returns> - public ChildInstanceExpression Child<T>() + public ChildInstanceExpression Child<CONSTRUCTORARGUMENTTYPE>() { - string propertyName = findPropertyName<T>(); + string propertyName = findPropertyName<CONSTRUCTORARGUMENTTYPE>(); - if (string.IsNullOrEmpty(propertyName)) - { - throw new StructureMapException(305, TypePath.GetAssemblyQualifiedName(typeof (T))); - } - ChildInstanceExpression child = new ChildInstanceExpression(this, _memento, propertyName); addChildExpression(child); - child.ChildType = typeof (T); + child.ChildType = typeof (CONSTRUCTORARGUMENTTYPE); return child; } private string findPropertyName<T>() { Plugin plugin = Plugin.CreateImplicitPlugin(_pluggedType); - return plugin.FindFirstConstructorArgumentOfType<T>(); + string propertyName = plugin.FindFirstConstructorArgumentOfType<T>(); + + if (string.IsNullOrEmpty(propertyName)) + { + throw new StructureMapException(305, TypePath.GetAssemblyQualifiedName(typeof(T))); + } + + return propertyName; } public override void ValidatePluggability(Type pluginType) @@ -158,5 +160,33 @@ return _parent; } } + + public ChildArrayExpression<PLUGINTYPE> ChildArray<PLUGINTYPE>() + { + validateTypeIsArray<PLUGINTYPE>(); + + string propertyName = findPropertyName<PLUGINTYPE>(); + return ChildArray<PLUGINTYPE>(propertyName); + } + + public ChildArrayExpression<PLUGINTYPE> ChildArray<PLUGINTYPE>(string propertyName) + { + validateTypeIsArray<PLUGINTYPE>(); + + ChildArrayExpression<PLUGINTYPE> expression = new ChildArrayExpression<PLUGINTYPE>(this, _memento, propertyName); + addChildExpression(expression); + + return expression; + } + + private static void validateTypeIsArray<PLUGINTYPE>() + { + if (!typeof(PLUGINTYPE).IsArray) + { + throw new StructureMapException(307); + } + } + + } } \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/DSL/LiteralMemento.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/LiteralMemento.cs 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/Source/StructureMap/Configuration/DSL/LiteralMemento.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -59,7 +59,7 @@ get { throw new NotImplementedException(); } } - public override object Build(IInstanceCreator creator) + protected override object buildInstance(IInstanceCreator creator) { return _instance; } Modified: trunk/Source/StructureMap/Configuration/DSL/MementoBuilder.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/MementoBuilder.cs 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/Source/StructureMap/Configuration/DSL/MementoBuilder.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -51,6 +51,22 @@ return thisInstance; } + public T OnCreation<TYPE>(StartupHandler<TYPE> handler) + { + StartupInterceptor<TYPE> interceptor = new StartupInterceptor<TYPE>(handler); + memento.Interceptor = interceptor; + + return thisInstance; + } + + public T EnrichWith<TYPE>(EnrichmentHandler<TYPE> handler) + { + EnrichmentInterceptor<TYPE> interceptor = new EnrichmentInterceptor<TYPE>(handler); + memento.Interceptor = interceptor; + + return thisInstance; + } + public string InstanceKey { get { return memento.InstanceKey; } Modified: trunk/Source/StructureMap/Configuration/DSL/PrototypeMemento.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/PrototypeMemento.cs 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/Source/StructureMap/Configuration/DSL/PrototypeMemento.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -20,7 +20,7 @@ set { _prototype = value; } } - public override object Build(IInstanceCreator creator) + protected override object buildInstance(IInstanceCreator creator) { return _prototype.Clone(); } Added: trunk/Source/StructureMap/Configuration/DSL/ReferenceMementoBuilder.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/ReferenceMementoBuilder.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/DSL/ReferenceMementoBuilder.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -0,0 +1,41 @@ +using System; +using StructureMap.Graph; + +namespace StructureMap.Configuration.DSL +{ + public class ReferenceMementoBuilder : IMementoBuilder + { + private InstanceMemento _memento; + + public ReferenceMementoBuilder(string referenceKey) + { + _memento = MemoryInstanceMemento.CreateReferencedInstanceMemento(referenceKey); + } + + InstanceMemento IMementoBuilder.BuildMemento(PluginFamily family) + { + return _memento; + } + + InstanceMemento IMementoBuilder.BuildMemento(PluginGraph graph) + { + return _memento; + } + + void IMementoBuilder.SetInstanceName(string instanceKey) + { + + } + + void IMementoBuilder.ValidatePluggability(Type pluginType) + { + + } + + + void IExpression.Configure(PluginGraph graph) + { + // no-op; + } + } +} \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/DSL/Registry.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Registry.cs 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/Source/StructureMap/Configuration/DSL/Registry.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -54,9 +54,9 @@ /// </summary> /// <typeparam name="PLUGINTYPE"></typeparam> /// <returns></returns> - public CreatePluginFamilyExpression BuildInstancesOf<PLUGINTYPE>() + public CreatePluginFamilyExpression<PLUGINTYPE> BuildInstancesOf<PLUGINTYPE>() { - CreatePluginFamilyExpression expression = new CreatePluginFamilyExpression(typeof (PLUGINTYPE)); + CreatePluginFamilyExpression<PLUGINTYPE> expression = new CreatePluginFamilyExpression<PLUGINTYPE>(); addExpression(expression); return expression; @@ -70,9 +70,9 @@ /// </summary> /// <typeparam name="PLUGINTYPE"></typeparam> /// <returns></returns> - public CreatePluginFamilyExpression ForRequestedType<PLUGINTYPE>() + public CreatePluginFamilyExpression<PLUGINTYPE> ForRequestedType<PLUGINTYPE>() { - CreatePluginFamilyExpression expression = new CreatePluginFamilyExpression(typeof(PLUGINTYPE)); + CreatePluginFamilyExpression<PLUGINTYPE> expression = new CreatePluginFamilyExpression<PLUGINTYPE>(); addExpression(expression); return expression; @@ -218,5 +218,11 @@ { return new ConstructorExpression<PLUGINTYPE>(builder); } + + public static ReferenceMementoBuilder Instance(string referencedKey) + { + return new ReferenceMementoBuilder(referencedKey); + } + } } \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/FamilyParser.cs =================================================================== --- trunk/Source/StructureMap/Configuration/FamilyParser.cs 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/Source/StructureMap/Configuration/FamilyParser.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -51,6 +51,17 @@ _builder.RegisterMemento(pluginTypePath, memento); } + public void ParseInstanceElement(XmlElement element) + { + TypePath pluginTypePath = TypePath.GetTypePath(element.GetAttribute(XmlConstants.PLUGIN_TYPE)); + InstanceScope scope = findScope(element); + + InstanceMemento memento = _mementoCreator.CreateMemento(element); + + _builder.AddPluginFamily(pluginTypePath, null, new string[0], scope); + _builder.RegisterMemento(pluginTypePath, memento); + } + private InstanceScope findScope(XmlElement familyElement) { InstanceScope returnValue = InstanceScope.PerRequest; @@ -108,5 +119,6 @@ } + } } \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/UserControlMemento.cs =================================================================== --- trunk/Source/StructureMap/Configuration/UserControlMemento.cs 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/Source/StructureMap/Configuration/UserControlMemento.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -25,7 +25,7 @@ set { _url = value; } } - public override object Build(IInstanceCreator creator) + protected override object buildInstance(IInstanceCreator creator) { return new Page().LoadControl(_url); } Modified: trunk/Source/StructureMap/Configuration/XmlConstants.cs =================================================================== --- trunk/Source/StructureMap/Configuration/XmlConstants.cs 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/Source/StructureMap/Configuration/XmlConstants.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -17,6 +17,7 @@ public const string CONCRETE_KEY_ATTRIBUTE = "ConcreteKey"; public const string INTERCEPTORS_NODE = "Interceptors"; public const string INSTANCE_NODE = "Instance"; + public const string ADD_INSTANCE_NODE = "AddInstance"; public const string INSTANCES_NODE = "Instances"; public const string TYPE_ATTRIBUTE = "Type"; public const string KEY_ATTRIBUTE = "Key"; Modified: trunk/Source/StructureMap/ConstructorMemento.cs =================================================================== --- trunk/Source/StructureMap/ConstructorMemento.cs 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/Source/StructureMap/ConstructorMemento.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -25,7 +25,7 @@ } - public override object Build(IInstanceCreator creator) + protected override object buildInstance(IInstanceCreator creator) { return _builder(); } Added: trunk/Source/StructureMap/Delegates.cs =================================================================== --- trunk/Source/StructureMap/Delegates.cs (rev 0) +++ trunk/Source/StructureMap/Delegates.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -0,0 +1,51 @@ +namespace StructureMap +{ + public delegate T EnrichmentHandler<T>(T target); + public delegate void StartupHandler<T>(T target); + + public interface InstanceInterceptor + { + object Process(object target); + } + + public class NulloInterceptor : InstanceInterceptor + { + public object Process(object target) + { + return target; + } + } + + public class StartupInterceptor<T> : InstanceInterceptor + { + private readonly StartupHandler<T> _handler; + + public StartupInterceptor(StartupHandler<T> handler) + { + _handler = handler; + } + + + public object Process(object target) + { + _handler((T) target); + return target; + } + } + + public class EnrichmentInterceptor<T> : InstanceInterceptor + { + private readonly EnrichmentHandler<T> _handler; + + + public EnrichmentInterceptor(EnrichmentHandler<T> handler) + { + _handler = handler; + } + + public object Process(object target) + { + return _handler((T) target); + } + } +} Modified: trunk/Source/StructureMap/Graph/PluginFamily.cs =================================================================== --- trunk/Source/StructureMap/Graph/PluginFamily.cs 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/Source/StructureMap/Graph/PluginFamily.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -36,6 +36,7 @@ private string _pluginTypeName; private InterceptionChain _interceptionChain; private PluginCollection _plugins; + private InstanceInterceptor _instanceInterceptor = new NulloInterceptor(); public const string CONCRETE_KEY = "CONCRETE"; @@ -109,6 +110,12 @@ #endregion + public InstanceInterceptor InstanceInterceptor + { + get { return _instanceInterceptor; } + set { _instanceInterceptor = value; } + } + public PluginFamily CreateTemplatedClone(params Type[] templateTypes) { Type templatedType = _pluginType.MakeGenericType(templateTypes); Modified: trunk/Source/StructureMap/IInstanceManager.cs =================================================================== --- trunk/Source/StructureMap/IInstanceManager.cs 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/Source/StructureMap/IInstanceManager.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -13,5 +13,6 @@ void SetDefaultsToProfile(string profile); InstanceDefaultManager DefaultManager { get; } + T CreateInstance<T>(InstanceMemento memento); } } \ No newline at end of file Modified: trunk/Source/StructureMap/InstanceFactory.cs =================================================================== --- trunk/Source/StructureMap/InstanceFactory.cs 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/Source/StructureMap/InstanceFactory.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -1,9 +1,9 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Collections.Specialized; using System.Data; using System.Reflection; +using StructureMap.Configuration.DSL; using StructureMap.Emitting; using StructureMap.Graph; using StructureMap.Source; @@ -18,7 +18,20 @@ private Type _pluginType; private Dictionary<string, InstanceBuilder> _instanceBuilders; private MementoSource _source; + private InstanceInterceptor _interceptor = new NulloInterceptor(); + #region static constructors + public static InstanceFactory CreateFactoryWithDefault(Type pluginType, object defaultInstance) + { + PluginFamily family = new PluginFamily(pluginType); + InstanceFactory factory = new InstanceFactory(family, true); + factory.SetDefault(new LiteralMemento(defaultInstance)); + + return factory; + } + #endregion + + #region constructor functions private InstanceFactory() @@ -41,6 +54,7 @@ try { + _interceptor = family.InstanceInterceptor; determineMementoSource(family); _pluginType = family.PluginType; processPlugins(family.Plugins.All); @@ -162,10 +176,8 @@ private InstanceMemento findMemento(string instanceKey) { - InstanceMemento memento = null; + InstanceMemento memento = _source.GetMemento(instanceKey); - memento = _source.GetMemento(instanceKey); - if (memento == null) { throw new StructureMapException(200, instanceKey, _pluginType.FullName); @@ -198,11 +210,12 @@ InstanceMemento resolvedMemento = _source.ResolveMemento(memento); - return resolvedMemento.Build(this); + object instance = resolvedMemento.Build(this); + return _interceptor.Process(instance); } - public object BuildInstance(InstanceMemento memento) + object IInstanceCreator.BuildInstance(InstanceMemento memento) { if (!_instanceBuilders.ContainsKey(memento.ConcreteKey)) { @@ -210,7 +223,7 @@ 201, memento.ConcreteKey, memento.InstanceKey, PluginType.FullName); } - InstanceBuilder builder = (InstanceBuilder) _instanceBuilders[memento.ConcreteKey]; + InstanceBuilder builder = _instanceBuilders[memento.ConcreteKey]; try { Modified: trunk/Source/StructureMap/InstanceManager.cs =================================================================== --- trunk/Source/StructureMap/InstanceManager.cs 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/Source/StructureMap/InstanceManager.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -4,7 +4,6 @@ using StructureMap.Configuration.DSL; using StructureMap.Exceptions; using StructureMap.Graph; -using StructureMap.Interceptors; namespace StructureMap { @@ -158,6 +157,11 @@ return (T) CreateInstance(typeof (T), instanceKey); } + public T CreateInstance<T>(InstanceMemento memento) + { + return (T) CreateInstance(typeof (T), memento); + } + /// <summary> /// Creates a new object instance of the requested type /// </summary> @@ -263,7 +267,7 @@ instanceFactory.SetDefault(instanceKey); } - public IInstanceFactory this[Type pluginType] + public virtual IInstanceFactory this[Type pluginType] { get { @@ -337,9 +341,9 @@ return (T) FillDependencies(typeof (T)); } - private delegate InstanceFactory CreateFactoryDelegate(Type type); + protected delegate InstanceFactory CreateFactoryDelegate(Type type); - private IInstanceFactory getOrCreateFactory(Type type, CreateFactoryDelegate createFactory) + protected IInstanceFactory getOrCreateFactory(Type type, CreateFactoryDelegate createFactory) { if (!_factories.ContainsKey(type)) { Modified: trunk/Source/StructureMap/InstanceMemento.cs =================================================================== --- trunk/Source/StructureMap/InstanceMemento.cs 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/Source/StructureMap/InstanceMemento.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -17,6 +17,7 @@ private DefinitionSource _definitionSource = DefinitionSource.Explicit; private string _concreteKey; private string _instanceKey; + private InstanceInterceptor _interceptor = new NulloInterceptor(); /// <summary> /// The named type of the object instance represented by the InstanceMemento. Translates to a concrete @@ -268,12 +269,32 @@ protected virtual string getPluggedType() { - return this.getPropertyValue(XmlConstants.PLUGGED_TYPE); + return getPropertyValue(XmlConstants.PLUGGED_TYPE); } - public virtual object Build(IInstanceCreator creator) + public object Build(IInstanceCreator creator) { + object instance = buildInstance(creator); + try + { + return _interceptor.Process(instance); + } + catch (Exception e) + { + throw new StructureMapException(308, e, InstanceKey, TypePath.GetAssemblyQualifiedName(instance.GetType())); + } + } + + protected virtual object buildInstance(IInstanceCreator creator) + { return creator.BuildInstance(this); } + + + public InstanceInterceptor Interceptor + { + get { return _interceptor; } + set { _interceptor = value; } + } } } \ No newline at end of file Modified: trunk/Source/StructureMap/Source/XmlAttributeInstanceMemento.cs =================================================================== --- trunk/Source/StructureMap/Source/XmlAttributeInstanceMemento.cs 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/Source/StructureMap/Source/XmlAttributeInstanceMemento.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -1,6 +1,7 @@ using System; using System.Collections; using System.Xml; +using StructureMap.Configuration; using StructureMap.Configuration.Tokens; namespace StructureMap.Source @@ -20,17 +21,17 @@ protected override string innerConcreteKey { - get { return _element.GetAttribute("Type"); } + get { return _element.GetAttribute(XmlConstants.TYPE_ATTRIBUTE); } } public void SetConcreteKey(string concreteKey) { - _element.SetAttribute("Type", concreteKey); + _element.SetAttribute(XmlConstants.TYPE_ATTRIBUTE, concreteKey); } protected override string innerInstanceKey { - get { return _element.GetAttribute("Key"); } + get { return _element.GetAttribute(XmlConstants.KEY_ATTRIBUTE); } } public XmlElement InnerElement Modified: trunk/Source/StructureMap/StructureMap.csproj =================================================================== --- trunk/Source/StructureMap/StructureMap.csproj 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/Source/StructureMap/StructureMap.csproj 2007-12-22 17:45:18 UTC (rev 50) @@ -209,6 +209,7 @@ <Compile Include="Configuration\DiagnosticGraphBuilder.cs"> <SubType>Code</SubType> </Compile> + <Compile Include="Configuration\DSL\ChildArrayExpression.cs" /> <Compile Include="Configuration\DSL\ChildInstanceExpression.cs" /> <Compile Include="Configuration\DSL\ConstructorExpression.cs" /> <Compile Include="Configuration\DSL\CreatePluginFamilyExpression.cs" /> @@ -224,6 +225,7 @@ <Compile Include="Configuration\DSL\PropertyExpression.cs" /> <Compile Include="Configuration\DSL\PrototypeExpression.cs" /> <Compile Include="Configuration\DSL\PrototypeMemento.cs" /> + <Compile Include="Configuration\DSL\ReferenceMementoBuilder.cs" /> <Compile Include="Configuration\DSL\Registry.cs" /> <Compile Include="Configuration\DSL\ScanAssembliesExpression.cs" /> <Compile Include="Configuration\DSL\UserControlExpression.cs" /> @@ -333,6 +335,7 @@ <SubType>Code</SubType> </Compile> <Compile Include="ConstructorMemento.cs" /> + <Compile Include="Delegates.cs" /> <Compile Include="DeploymentTasks\DeploymentConfiguration.cs"> <SubType>Code</SubType> </Compile> Modified: trunk/Source/StructureMap/StructureMapConfiguration.cs =================================================================== --- trunk/Source/StructureMap/StructureMapConfiguration.cs 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/Source/StructureMap/StructureMapConfiguration.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -164,11 +164,11 @@ /// <summary> /// Direct StructureMap to create instances of Type T /// </summary> - /// <typeparam name="T">The Type to build</typeparam> + /// <typeparam name="PLUGINTYPE">The Type to build</typeparam> /// <returns></returns> - public static CreatePluginFamilyExpression BuildInstancesOf<T>() + public static CreatePluginFamilyExpression<PLUGINTYPE> BuildInstancesOf<PLUGINTYPE>() { - return _registry.BuildInstancesOf<T>(); + return _registry.BuildInstancesOf<PLUGINTYPE>(); } /// <summary> Modified: trunk/Source/StructureMap/StructureMapException.resx =================================================================== --- trunk/Source/StructureMap/StructureMapException.resx 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/Source/StructureMap/StructureMapException.resx 2007-12-22 17:45:18 UTC (rev 50) @@ -252,4 +252,10 @@ <data name="306" xml:space="preserve"> <value>The configured BuilderDelegate of type {0} does not match the PluginFamily type {1}</value> </data> + <data name="307" xml:space="preserve"> + <value>In the call to ChildArray<T>(), the type T must be an array</value> + </data> + <data name="308" xml:space="preserve"> + <value>A configured instance interceptor has failed for Instance '{0}' and concrete type '{1}'</value> + </data> </root> \ No newline at end of file Added: trunk/Source/StructureMap.AutoMocking/AutoMockedInstanceManager.cs =================================================================== --- trunk/Source/StructureMap.AutoMocking/AutoMockedInstanceManager.cs (rev 0) +++ trunk/Source/StructureMap.AutoMocking/AutoMockedInstanceManager.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -0,0 +1,39 @@ +using System; + +namespace StructureMap.AutoMocking +{ + public interface ServiceLocator + { + T Service<T>(); + object Service(Type serviceType); + } + + public class AutoMockedInstanceManager : InstanceManager + { + private readonly ServiceLocator _locator; + + public AutoMockedInstanceManager(ServiceLocator locator) + { + _locator = locator; + } + + public override IInstanceFactory this[Type pluginType] + { + get + { + return getOrCreateFactory(pluginType, + delegate + { + object service = _locator.Service(pluginType); + InstanceFactory factory + = InstanceFactory.CreateFactoryWithDefault(pluginType, service); + + return factory; + }); + + + } + set { base[pluginType] = value; } + } + } +} Added: trunk/Source/StructureMap.AutoMocking/Properties/AssemblyInfo.cs =================================================================== --- trunk/Source/StructureMap.AutoMocking/Properties/AssemblyInfo.cs (rev 0) +++ trunk/Source/StructureMap.AutoMocking/Properties/AssemblyInfo.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -0,0 +1,9 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("StructureMap.AutoMocking")] +[assembly: AssemblyDescription("")] Added: trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs =================================================================== --- trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs (rev 0) +++ trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using Rhino.Mocks; + +namespace StructureMap.AutoMocking +{ + public delegate void GenericVoidMethod<TARGETCLASS>(TARGETCLASS target); + public delegate void VoidMethod(); + + public class RhinoAutoMocker : MockRepository, ServiceLocator + { + private Dictionary<Type, object> _services; + private AutoMockedInstanceManager _manager; + + public RhinoAutoMocker() + { + _services = new Dictionary<Type, object>(); + _manager = new AutoMockedInstanceManager(this); + } + + public TARGETCLASS Create<TARGETCLASS>() + { + throw new NotImplementedException(); + } + + public T Service<T>() + { + throw new NotImplementedException(); + } + + public T UsePartialMock<T>() + { + throw new NotImplementedException(); + } + + public void Inject<T>(T stub) + { + throw new NotImplementedException(); + } + + public object Service(Type serviceType) + { + throw new NotImplementedException(); + } + } +} Added: trunk/Source/StructureMap.AutoMocking/StructureMap.AutoMocking.csproj =================================================================== --- trunk/Source/StructureMap.AutoMocking/StructureMap.AutoMocking.csproj (rev 0) +++ trunk/Source/StructureMap.AutoMocking/StructureMap.AutoMocking.csproj 2007-12-22 17:45:18 UTC (rev 50) @@ -0,0 +1,61 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{0ED1B206-A1C9-4A52-BA87-3BA416C8725C}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>StructureMap.AutoMocking</RootNamespace> + <AssemblyName>StructureMap.AutoMocking</AssemblyName> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Rhino.Mocks, Version=2.9.1.10183, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\bin\Rhino.Mocks.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="..\CommonAssemblyInfo.cs"> + <Link>CommonAssemblyInfo.cs</Link> + </Compile> + <Compile Include="AutoMockedInstanceManager.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="RhinoAutoMocker.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\StructureMap\StructureMap.csproj"> + <Project>{3F36EA80-2F9A-4DAD-BA27-5AC6163A2EE3}</Project> + <Name>StructureMap</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file Added: trunk/Source/StructureMap.Testing/AutoMocking/RhinoAutoMockerTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/AutoMocking/RhinoAutoMockerTester.cs (rev 0) +++ trunk/Source/StructureMap.Testing/AutoMocking/RhinoAutoMockerTester.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -0,0 +1,14 @@ +using NUnit.Framework; +using Rhino.Mocks; + +namespace StructureMap.Testing.AutoMocking +{ + [TestFixture] + public class RhinoAutoMockerTester + { + [SetUp] + public void SetUp() + { + } + } +} Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/ConstructorExpressionTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DSL/ConstructorExpressionTester.cs 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/Source/StructureMap.Testing/Configuration/DSL/ConstructorExpressionTester.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -1,12 +1,11 @@ using NUnit.Framework; -using Rhino.Mocks; using StructureMap.Configuration.DSL; -using StructureMap.Testing.Container; +using StructureMap.Testing.Graph; namespace StructureMap.Testing.Configuration.DSL { [TestFixture] - public class ConstructorExpressionTester + public class ConstructorExpressionTester : Registry { [SetUp] public void SetUp() @@ -15,9 +14,13 @@ ObjectFactory.Reset(); } - public interface Abstraction { } + public interface Abstraction + { + } - public class Concretion : Abstraction { } + public class Concretion : Abstraction + { + } [Test] public void ConstructSomething() @@ -26,7 +29,7 @@ Registry registry = new Registry(); registry.ForRequestedType<Abstraction>().TheDefaultIs( - Registry.ConstructedBy<Abstraction>(delegate { return concretion; }) + ConstructedBy<Abstraction>(delegate { return concretion; }) ); IInstanceManager manager = registry.BuildInstanceManager(); @@ -40,15 +43,14 @@ Registry registry = new Registry(); registry.ForRequestedType<Abstraction>().AddInstance( - Registry.ConstructedBy<Abstraction>(delegate { return concretion; }) + ConstructedBy<Abstraction>(delegate { return concretion; }) ); - + IInstanceManager manager = registry.BuildInstanceManager(); Abstraction actual = manager.GetAllInstances<Abstraction>()[0]; Assert.AreSame(concretion, actual); - } [Test] @@ -59,18 +61,17 @@ Registry registry = new Registry(); registry.ForRequestedType<Abstraction>().AddInstance( - Registry.ConstructedBy<Abstraction>(delegate { return concretion1; }).WithName("One") + ConstructedBy<Abstraction>(delegate { return concretion1; }).WithName("One") ); registry.ForRequestedType<Abstraction>().AddInstance( - Registry.ConstructedBy<Abstraction>(delegate { return concretion2; }).WithName("Two") + ConstructedBy<Abstraction>(delegate { return concretion2; }).WithName("Two") ); IInstanceManager manager = registry.BuildInstanceManager(); Assert.AreSame(concretion1, manager.CreateInstance<Abstraction>("One")); Assert.AreSame(concretion2, manager.CreateInstance<Abstraction>("Two")); - } [Test] @@ -82,19 +83,16 @@ Registry registry = new Registry(); registry.ForRequestedType<Abstraction>() .AddInstance( - Registry.ConstructedBy<Abstraction>(delegate { return concretion1; }).WithName("One") + ConstructedBy<Abstraction>(delegate { return concretion1; }).WithName("One") ) .AddInstance( - Registry.ConstructedBy<Abstraction>(delegate { return concretion2; }).WithName("Two") + ConstructedBy<Abstraction>(delegate { return concretion2; }).WithName("Two") ); IInstanceManager manager = registry.BuildInstanceManager(); Assert.AreSame(concretion1, manager.CreateInstance<Abstraction>("One")); Assert.AreSame(concretion2, manager.CreateInstance<Abstraction>("Two")); - - } + } } - - -} +} \ No newline at end of file Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs 2007-12-14 11:16:38 UTC (rev 49) +++ trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -16,13 +16,6 @@ { } - [Test, ExpectedException(typeof (StructureMapException))] - public void TheConceteTypeDoesNotCase() - { - Registry registry = new Registry(); - registry.BuildInstancesOf<Rule>().TheDefaultIsConcreteType<IWidget>(); - } - [Test] public void TheDefaultInstanceIsConcreteType() { @@ -104,7 +97,7 @@ PluginGraph pluginGraph = new PluginGraph(); using (Registry registry = new Registry(pluginGraph)) { - CreatePluginFamilyExpression expression = + CreatePluginFamilyExpression<IGateway> expression = registry.BuildInstancesOf<IGateway>(); Assert.IsNotNull(expression); } @@ -119,7 +112,7 @@ PluginGraph pluginGraph = new PluginGraph(); using (Registry registry = new Registry(pluginGraph)) { - CreatePluginFamilyExpression expression = + CreatePluginFamilyExpression<IGateway> expression = registry.BuildInstancesOf<IGateway>().CacheBy(InstanceScope.ThreadLocal); Assert.IsNotNull(expression); } @@ -134,7 +127,7 @@ PluginGraph pluginGraph = new PluginGraph(); using (Registry registry = new Registry(pluginGraph)) { - CreatePluginFamilyExpression expression = + CreatePluginFamilyExpression<IGateway> expression = registry.BuildInstancesOf<IGateway>().AsSingletons(); Assert.IsNotNull(expression); } Added: trunk/Source/StructureMap.Testing/Configuration/DSL/InjectArrayTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DSL/InjectArrayTester.cs (rev 0) +++ trunk/Source/StructureMap.Testing/Configuration/DSL/InjectArrayTester.cs 2007-12-22 17:45:18 UTC (rev 50) @@ -0,0 +1,216 @@ +using NUnit.Framework; +using StructureMap.Configuration.DSL; + +namespace StructureMap.Testing.Configuration.DSL +{ + [TestFixture] + public class InjectArrayTester + { + [SetUp] + public void SetUp() + { + } + + [Test] + public void ProgrammaticallyInjectArrayAllInline() + { + Registry registry = new Registry(); + + registry.ForRequestedType<Processor>() + .TheDefaultIs( + Registry.Instance<Processor>().UsingConcreteType<Processor>() + .ChildArray<IHandler[]>().Contains( + Registry.Instance<IHandler>().UsingConcreteType<Handler1>(), + Registry.Instance<IHandler>().UsingConcreteType<Handler2>(), + Registry.Instance<IHandler>().UsingConcreteType<Handler3>() + ) + .WithProperty("name").EqualTo("Jeremy") + ); + + IInstanceManager manager = registry.BuildInstanceManager(); + Processor processor = manager.CreateInstance<Processor>(); + + Assert.IsInstanceOfType(typeof (Handler1), processor.Handlers[0]); + Assert.IsInstanceOfType(typeof (Handler2), processor.Handlers[1]); + Assert.IsInstanceOfType(typeof (Handler3), processor.Handlers[2]); + } + + [Test] + public void CanStillAddOtherPropertiesAfterTheCallToChildArray() + { + Registry registry = new Registry(); + + registry.ForRequestedType<Processor>() + .TheDefaultIs( + Registry.Instance<Processor>().UsingConcreteType<Processor>() + .ChildArray<IHandler[]>().Contains( + Registry.Instance<IHandler>().UsingConcreteType<Handler1>(), + Registry.Instance<IHandler>().UsingConcreteType<Handler2>(), + Registry.Instance<IHandler>().UsingConcreteType<Handler3>() + ) + .WithProperty("name").EqualTo("Jeremy") + ); + + IInstanceManager manager = registry.BuildInstanceManager(); + Processor processor = manager.CreateInstance<Processor>(); + + Assert.AreEqual("Jeremy", processor.Name); + } + + [Test, + ExpectedException(typeof (StructureMapException), + ExpectedMessage = + "StructureMap Exception Code: 307\nIn the call to ChildArray<T>(), the type T must be an array")] + public void TryToInjectByTheElementTypeInsteadOfTheArrayType() + { + Registry registry = new Registry(); + + registry.ForRequestedType<Processor>() + .TheDefaultIs( + Registry.Instance<Processor>().UsingConcreteType<Processor>() + .WithProperty("name").EqualTo("Jeremy") + .ChildArray<IHandler>().Contains( + Registry.Instance<IHandler>().UsingConcreteType<Handler1>()) + ); + } + + + [Test, + ExpectedException(typeof (StructureMapException), + ExpectedMessage = + "StructureMap Exception Code: 307\nIn the call to ChildArray<T>(), the type T must be an array")] + public void InjectPropertiesByNameButUseTheElementType() + { + Registry registry = new Registry(); + + registry.ForRequestedType<Processor2>() + .TheDefaultIs( + Registry.Instance<Processor2>().UsingConcreteType<Processor2>() + .ChildArray<IHandler>("first").Contains( + Registry.Instance<IHandler>().UsingConcreteType<Handler1>(), + Registry.Instance<IHandler>().UsingConcreteType<Handler2>() + ) + .ChildArray<IHandler[]>("second").Contains( + Registry.Instance<IHandler>().UsingConcreteType<Handler2>(), + Registry.Instance<IHandler>().UsingConcreteType<Handler3>() + ) + ); + } + + [Test] + public void InjectPropertiesByName() + { + Registry registry = new Registry(); + + registry.ForRequestedType<Processor2>() + .TheDefaultIs( + Registry.Instance<Processor2>().UsingConcreteType<Processor2>() + .ChildArray<IHandler[]>("first").Contains( + Registry.Instance<IHandler>().UsingConcreteType<Handler1>(), + Registry.Instance<IHandler>().UsingConcreteType<Handler2>() + ) + .ChildArray<IHandler[]>("second").Contains( + Registry.Instance<IHandler>().UsingConcreteType<Handler2>(), + Registry.Instance<IHandler>().UsingConcreteType<Handler3>() + ) + ); + + IInstanceManager manager = registry.BuildInstanceManager(); + Processor2 processor = manager.CreateInstance<Processor2>(); + + Assert.IsInstanceOfType(typeof (Handler1), processor.First[0]); + Assert.IsInstanceOfType(typeof (Handler2), processor.First[1]); + Assert.IsInstanceOfType(typeof (Handler2), processor.Second[0]); + Assert.IsInstanceOfType(typeof (Handler3), processor.Second[1]); + } + + [Test] + public void PlaceMemberInArrayByReference() + { + Registry registry = new Registry(); + registry.AddInstanceOf<IHandler>().UsingConcreteType<Handler1>().WithName("One"); + registry.AddInstanceOf<IHandler>().UsingConcreteType<Handler2>().WithName("Two"); + + registry.ForRequestedType<Processor>() + .TheDefaultIs( + Registry.Instance<Processor>().UsingConcreteType<Processor>() + .WithProperty("name").EqualTo("Jeremy") + .ChildArray<IHandler[]>().Contains( + Registry.Instance("Two"), + Registry.Instance("One") + ) + ); + + IInstanceManager manager = registry.BuildInstanceManager(); + Processor processor = manager.CreateInstance<Processor>(); + + Assert.IsInstanceOfType(typeof(Handler2), processor.Handlers[0]); + Assert.IsInstanceOfType(typeof(Handler1), pr... [truncated message content] |
From: <jer...@us...> - 2007-12-30 16:31:13
|
Revision: 51 http://structuremap.svn.sourceforge.net/structuremap/?rev=51&view=rev Author: jeremydmiller Date: 2007-12-30 08:31:10 -0800 (Sun, 30 Dec 2007) Log Message: ----------- updating RhinoMocks, the first cut at automocking, some clean up Modified Paths: -------------- trunk/Source/StructureMap/Configuration/ConfigurationParser.cs trunk/Source/StructureMap/Configuration/DSL/ConstructorExpression.cs trunk/Source/StructureMap/Configuration/DSL/CreatePluginFamilyExpression.cs trunk/Source/StructureMap/Configuration/DSL/InstanceExpression.cs trunk/Source/StructureMap/Configuration/DSL/ReferenceMementoBuilder.cs trunk/Source/StructureMap/Configuration/DSL/Registry.cs trunk/Source/StructureMap/Configuration/FamilyParser.cs trunk/Source/StructureMap/ConstructorMemento.cs trunk/Source/StructureMap/Delegates.cs trunk/Source/StructureMap/DeploymentTasks/DeploymentExecutor.cs trunk/Source/StructureMap/Graph/Plugin.cs trunk/Source/StructureMap/Graph/PluginFamily.cs trunk/Source/StructureMap/InstanceBuilder.cs trunk/Source/StructureMap/InstanceFactory.cs trunk/Source/StructureMap/InstanceManager.cs trunk/Source/StructureMap/InstanceMemento.cs trunk/Source/StructureMap/MemoryInstanceMemento.cs trunk/Source/StructureMap/StructureMapConfiguration.cs trunk/Source/StructureMap.AutoMocking/AutoMockedInstanceManager.cs trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs trunk/Source/StructureMap.AutoMocking/StructureMap.AutoMocking.csproj trunk/Source/StructureMap.Testing/AutoMocking/RhinoAutoMockerTester.cs trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj trunk/bin/Rhino.Mocks.dll Added Paths: ----------- trunk/Source/StructureMap.AutoMocking/RhinoMocksServiceLocator.cs trunk/Source/StructureMap.AutoMocking/ServiceLocator.cs trunk/Source/StructureMap.Testing/NewFolder1/ Removed Paths: ------------- trunk/Source/StructureMap.Testing.GenericWidgets/bin/ Property Changed: ---------------- trunk/Source/StructureMap.Testing/ Modified: trunk/Source/StructureMap/Configuration/ConfigurationParser.cs =================================================================== --- trunk/Source/StructureMap/Configuration/ConfigurationParser.cs 2007-12-22 17:45:18 UTC (rev 50) +++ trunk/Source/StructureMap/Configuration/ConfigurationParser.cs 2007-12-30 16:31:10 UTC (rev 51) @@ -167,7 +167,7 @@ public void ParseFamilies(IGraphBuilder builder) { FamilyParser familyParser = new FamilyParser(builder, _mementoCreator); - + XmlNodeList familyNodes = findNodes(XmlConstants.PLUGIN_FAMILY_NODE); foreach (XmlElement familyElement in familyNodes) { @@ -185,7 +185,6 @@ { familyParser.ParseInstanceElement(element); } - } Modified: trunk/Source/StructureMap/Configuration/DSL/ConstructorExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/ConstructorExpression.cs 2007-12-22 17:45:18 UTC (rev 50) +++ trunk/Source/StructureMap/Configuration/DSL/ConstructorExpression.cs 2007-12-30 16:31:10 UTC (rev 51) @@ -39,7 +39,7 @@ public override void ValidatePluggability(Type pluginType) { - if (!pluginType.Equals(typeof(PLUGINTYPE))) + if (!pluginType.Equals(typeof (PLUGINTYPE))) { throw new StructureMapException(306, typeof (PLUGINTYPE).FullName, pluginType.FullName); Modified: trunk/Source/StructureMap/Configuration/DSL/CreatePluginFamilyExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/CreatePluginFamilyExpression.cs 2007-12-22 17:45:18 UTC (rev 50) +++ trunk/Source/StructureMap/Configuration/DSL/CreatePluginFamilyExpression.cs 2007-12-30 16:31:10 UTC (rev 51) @@ -20,7 +20,7 @@ public CreatePluginFamilyExpression() { - _pluginType = typeof(PLUGINTYPE); + _pluginType = typeof (PLUGINTYPE); } void IExpression.Configure(PluginGraph graph) @@ -70,7 +70,7 @@ builder.ValidatePluggability(_pluginType); _children.Add(builder); - _alterations.Add(delegate (PluginFamily family) + _alterations.Add(delegate(PluginFamily family) { InstanceMemento memento = builder.BuildMemento(family); family.Source.AddExternalMemento(memento); @@ -86,7 +86,8 @@ /// </summary> /// <typeparam name="CONCRETETYPE"></typeparam> /// <returns></returns> - public CreatePluginFamilyExpression<PLUGINTYPE> TheDefaultIsConcreteType<CONCRETETYPE>() where CONCRETETYPE : PLUGINTYPE + public CreatePluginFamilyExpression<PLUGINTYPE> TheDefaultIsConcreteType<CONCRETETYPE>() + where CONCRETETYPE : PLUGINTYPE { ExpressionValidator.ValidatePluggabilityOf(typeof (CONCRETETYPE)).IntoPluginType(_pluginType); @@ -130,20 +131,16 @@ public CreatePluginFamilyExpression<PLUGINTYPE> OnCreation(StartupHandler<PLUGINTYPE> handler) { - _alterations.Add(delegate (PluginFamily family) - { - family.InstanceInterceptor = new StartupInterceptor<PLUGINTYPE>(handler); - }); + _alterations.Add( + delegate(PluginFamily family) { family.InstanceInterceptor = new StartupInterceptor<PLUGINTYPE>(handler); }); return this; } public CreatePluginFamilyExpression<PLUGINTYPE> EnrichWith(EnrichmentHandler<PLUGINTYPE> handler) { - _alterations.Add(delegate(PluginFamily family) - { - family.InstanceInterceptor = new EnrichmentInterceptor<PLUGINTYPE>(handler); - }); + _alterations.Add( + delegate(PluginFamily family) { family.InstanceInterceptor = new EnrichmentInterceptor<PLUGINTYPE>(handler); }); return this; } Modified: trunk/Source/StructureMap/Configuration/DSL/InstanceExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/InstanceExpression.cs 2007-12-22 17:45:18 UTC (rev 50) +++ trunk/Source/StructureMap/Configuration/DSL/InstanceExpression.cs 2007-12-30 16:31:10 UTC (rev 51) @@ -102,10 +102,10 @@ { Plugin plugin = Plugin.CreateImplicitPlugin(_pluggedType); string propertyName = plugin.FindFirstConstructorArgumentOfType<T>(); - + if (string.IsNullOrEmpty(propertyName)) { - throw new StructureMapException(305, TypePath.GetAssemblyQualifiedName(typeof(T))); + throw new StructureMapException(305, TypePath.GetAssemblyQualifiedName(typeof (T))); } return propertyName; @@ -173,7 +173,8 @@ { validateTypeIsArray<PLUGINTYPE>(); - ChildArrayExpression<PLUGINTYPE> expression = new ChildArrayExpression<PLUGINTYPE>(this, _memento, propertyName); + ChildArrayExpression<PLUGINTYPE> expression = + new ChildArrayExpression<PLUGINTYPE>(this, _memento, propertyName); addChildExpression(expression); return expression; @@ -181,12 +182,10 @@ private static void validateTypeIsArray<PLUGINTYPE>() { - if (!typeof(PLUGINTYPE).IsArray) + if (!typeof (PLUGINTYPE).IsArray) { throw new StructureMapException(307); } } - - } } \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/DSL/ReferenceMementoBuilder.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/ReferenceMementoBuilder.cs 2007-12-22 17:45:18 UTC (rev 50) +++ trunk/Source/StructureMap/Configuration/DSL/ReferenceMementoBuilder.cs 2007-12-30 16:31:10 UTC (rev 51) @@ -24,12 +24,10 @@ void IMementoBuilder.SetInstanceName(string instanceKey) { - } void IMementoBuilder.ValidatePluggability(Type pluginType) { - } Modified: trunk/Source/StructureMap/Configuration/DSL/Registry.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Registry.cs 2007-12-22 17:45:18 UTC (rev 50) +++ trunk/Source/StructureMap/Configuration/DSL/Registry.cs 2007-12-30 16:31:10 UTC (rev 51) @@ -75,7 +75,7 @@ CreatePluginFamilyExpression<PLUGINTYPE> expression = new CreatePluginFamilyExpression<PLUGINTYPE>(); addExpression(expression); - return expression; + return expression; } public IInstanceManager BuildInstanceManager() @@ -97,7 +97,6 @@ return expression.TypeExpression(); } - /// <summary> /// Convenience method to start the definition of an instance of type T @@ -223,6 +222,5 @@ { return new ReferenceMementoBuilder(referencedKey); } - } } \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/FamilyParser.cs =================================================================== --- trunk/Source/StructureMap/Configuration/FamilyParser.cs 2007-12-22 17:45:18 UTC (rev 50) +++ trunk/Source/StructureMap/Configuration/FamilyParser.cs 2007-12-30 16:31:10 UTC (rev 51) @@ -117,8 +117,5 @@ _builder.AddInterceptor(pluginTypePath, interceptorMemento); } } - - - } } \ No newline at end of file Modified: trunk/Source/StructureMap/ConstructorMemento.cs =================================================================== --- trunk/Source/StructureMap/ConstructorMemento.cs 2007-12-22 17:45:18 UTC (rev 50) +++ trunk/Source/StructureMap/ConstructorMemento.cs 2007-12-30 16:31:10 UTC (rev 51) @@ -22,7 +22,6 @@ public ConstructorMemento(BuildObjectDelegate<PLUGINTYPE> builder) : this(Guid.NewGuid().ToString(), builder) { - } protected override object buildInstance(IInstanceCreator creator) @@ -37,4 +36,4 @@ set { _builder = value; } } } -} +} \ No newline at end of file Modified: trunk/Source/StructureMap/Delegates.cs =================================================================== --- trunk/Source/StructureMap/Delegates.cs 2007-12-22 17:45:18 UTC (rev 50) +++ trunk/Source/StructureMap/Delegates.cs 2007-12-30 16:31:10 UTC (rev 51) @@ -1,6 +1,7 @@ namespace StructureMap { public delegate T EnrichmentHandler<T>(T target); + public delegate void StartupHandler<T>(T target); public interface InstanceInterceptor @@ -48,4 +49,4 @@ return _handler((T) target); } } -} +} \ No newline at end of file Modified: trunk/Source/StructureMap/DeploymentTasks/DeploymentExecutor.cs =================================================================== --- trunk/Source/StructureMap/DeploymentTasks/DeploymentExecutor.cs 2007-12-22 17:45:18 UTC (rev 50) +++ trunk/Source/StructureMap/DeploymentTasks/DeploymentExecutor.cs 2007-12-30 16:31:10 UTC (rev 51) @@ -65,7 +65,8 @@ _sourceConfigDocument = new XmlDocument(); _sourceConfigDocument.Load(configPath); - PluginGraphBuilder builder = new PluginGraphBuilder(new ConfigurationParser(_sourceConfigDocument.DocumentElement)); + PluginGraphBuilder builder = + new PluginGraphBuilder(new ConfigurationParser(_sourceConfigDocument.DocumentElement)); _report = createPluginGraphReport(builder); _defaultManager = builder.DefaultManager; Modified: trunk/Source/StructureMap/Graph/Plugin.cs =================================================================== --- trunk/Source/StructureMap/Graph/Plugin.cs 2007-12-22 17:45:18 UTC (rev 50) +++ trunk/Source/StructureMap/Graph/Plugin.cs 2007-12-30 16:31:10 UTC (rev 51) @@ -16,7 +16,7 @@ public static Plugin CreateAutofilledPlugin(Type concreteType) { string pluginKey = Guid.NewGuid().ToString(); - Plugin plugin = Plugin.CreateExplicitPlugin(concreteType, pluginKey, string.Empty); + Plugin plugin = CreateExplicitPlugin(concreteType, pluginKey, string.Empty); if (!plugin.CanBeAutoFilled) { throw new StructureMapException(231); @@ -140,6 +140,25 @@ return new Plugin(pluggedType, concreteKey, DefinitionSource.Explicit); } + public static ConstructorInfo GetGreediestConstructor(Type pluggedType) + { + ConstructorInfo returnValue = null; + + foreach (ConstructorInfo constructor in pluggedType.GetConstructors()) + { + if (returnValue == null) + { + returnValue = constructor; + } + else if (constructor.GetParameters().Length > returnValue.GetParameters().Length) + { + returnValue = constructor; + } + } + + return returnValue; + } + #endregion private Type _pluggedType; @@ -231,17 +250,7 @@ // if no constructor is marked as the "ContainerConstructor", find the greediest constructor if (returnValue == null) { - foreach (ConstructorInfo constructor in _pluggedType.GetConstructors()) - { - if (returnValue == null) - { - returnValue = constructor; - } - else if (constructor.GetParameters().Length > returnValue.GetParameters().Length) - { - returnValue = constructor; - } - } + returnValue = GetGreediestConstructor(_pluggedType); } if (returnValue == null) @@ -252,6 +261,8 @@ return returnValue; } + + /// <summary> /// The ConcreteKey that identifies the Plugin within a PluginFamily /// </summary> Modified: trunk/Source/StructureMap/Graph/PluginFamily.cs =================================================================== --- trunk/Source/StructureMap/Graph/PluginFamily.cs 2007-12-22 17:45:18 UTC (rev 50) +++ trunk/Source/StructureMap/Graph/PluginFamily.cs 2007-12-30 16:31:10 UTC (rev 51) @@ -1,5 +1,4 @@ using System; -using System.Reflection; using StructureMap.Interceptors; using StructureMap.Source; @@ -160,17 +159,17 @@ } Type[] pluginArgs = _pluginType.GetGenericArguments(); Type[] pluggableArgs = interfaceType.GetGenericArguments(); - + if (templateTypes.Length != pluginArgs.Length && pluginArgs.Length != pluggableArgs.Length) { return false; } - + for (int i = 0; i < templateTypes.Length; i++) { isValid &= templateTypes[i] == pluggableArgs[i] || - pluginArgs[i].IsGenericParameter && + pluginArgs[i].IsGenericParameter && pluggableArgs[i].IsGenericParameter; } return isValid; Modified: trunk/Source/StructureMap/InstanceBuilder.cs =================================================================== --- trunk/Source/StructureMap/InstanceBuilder.cs 2007-12-22 17:45:18 UTC (rev 50) +++ trunk/Source/StructureMap/InstanceBuilder.cs 2007-12-30 16:31:10 UTC (rev 51) @@ -1,5 +1,4 @@ using System; -using StructureMap.Graph; namespace StructureMap { @@ -35,5 +34,10 @@ Type plugged = Type.GetType(PluggedType); return plugged.Equals(type); } + + //public Type GetPluggedType() + //{ + // return Type.GetType(PluggedType); + //} } } \ No newline at end of file Modified: trunk/Source/StructureMap/InstanceFactory.cs =================================================================== --- trunk/Source/StructureMap/InstanceFactory.cs 2007-12-22 17:45:18 UTC (rev 50) +++ trunk/Source/StructureMap/InstanceFactory.cs 2007-12-30 16:31:10 UTC (rev 51) @@ -21,6 +21,7 @@ private InstanceInterceptor _interceptor = new NulloInterceptor(); #region static constructors + public static InstanceFactory CreateFactoryWithDefault(Type pluginType, object defaultInstance) { PluginFamily family = new PluginFamily(pluginType); @@ -29,9 +30,9 @@ return factory; } + #endregion - #region constructor functions private InstanceFactory() @@ -363,7 +364,7 @@ } Plugin plugin = Plugin.CreateImplicitPlugin(typeof (T)); - processPlugins(new Plugin[]{plugin}); + processPlugins(new Plugin[] {plugin}); plugin.AddToSource(_source); return plugin.CreateImplicitMemento(); Modified: trunk/Source/StructureMap/InstanceManager.cs =================================================================== --- trunk/Source/StructureMap/InstanceManager.cs 2007-12-22 17:45:18 UTC (rev 50) +++ trunk/Source/StructureMap/InstanceManager.cs 2007-12-30 16:31:10 UTC (rev 51) @@ -422,7 +422,7 @@ public void AddInstance<PLUGINTYPE, CONCRETETYPE>() { - IInstanceFactory factory = getOrCreateFactory(typeof(PLUGINTYPE), createFactory); + IInstanceFactory factory = getOrCreateFactory(typeof (PLUGINTYPE), createFactory); InstanceMemento memento = factory.AddType<CONCRETETYPE>(); factory.AddInstance(memento); } Modified: trunk/Source/StructureMap/InstanceMemento.cs =================================================================== --- trunk/Source/StructureMap/InstanceMemento.cs 2007-12-22 17:45:18 UTC (rev 50) +++ trunk/Source/StructureMap/InstanceMemento.cs 2007-12-30 16:31:10 UTC (rev 51) @@ -281,7 +281,8 @@ } catch (Exception e) { - throw new StructureMapException(308, e, InstanceKey, TypePath.GetAssemblyQualifiedName(instance.GetType())); + throw new StructureMapException(308, e, InstanceKey, + TypePath.GetAssemblyQualifiedName(instance.GetType())); } } Modified: trunk/Source/StructureMap/MemoryInstanceMemento.cs =================================================================== --- trunk/Source/StructureMap/MemoryInstanceMemento.cs 2007-12-22 17:45:18 UTC (rev 50) +++ trunk/Source/StructureMap/MemoryInstanceMemento.cs 2007-12-30 16:31:10 UTC (rev 51) @@ -7,8 +7,9 @@ public class GenericMemento<T> : MemoryInstanceMemento { public GenericMemento(string instanceKey) - : base(Plugin.CreateImplicitPlugin(typeof(T)).ConcreteKey, instanceKey) - {} + : base(Plugin.CreateImplicitPlugin(typeof (T)).ConcreteKey, instanceKey) + { + } } /// <summary> Modified: trunk/Source/StructureMap/StructureMapConfiguration.cs =================================================================== --- trunk/Source/StructureMap/StructureMapConfiguration.cs 2007-12-22 17:45:18 UTC (rev 50) +++ trunk/Source/StructureMap/StructureMapConfiguration.cs 2007-12-30 16:31:10 UTC (rev 51) @@ -81,7 +81,7 @@ if (_pullConfigurationFromAppConfig) { IList<XmlNode> appConfigNodes = StructureMapConfigurationSection.GetStructureMapConfiguration(); - foreach(XmlNode appConfigNode in appConfigNodes) + foreach (XmlNode appConfigNode in appConfigNodes) { _collection.IncludeNode( delegate() { return appConfigNode; }); Modified: trunk/Source/StructureMap.AutoMocking/AutoMockedInstanceManager.cs =================================================================== --- trunk/Source/StructureMap.AutoMocking/AutoMockedInstanceManager.cs 2007-12-22 17:45:18 UTC (rev 50) +++ trunk/Source/StructureMap.AutoMocking/AutoMockedInstanceManager.cs 2007-12-30 16:31:10 UTC (rev 51) @@ -1,12 +1,9 @@ using System; +using Rhino.Mocks; namespace StructureMap.AutoMocking { - public interface ServiceLocator - { - T Service<T>(); - object Service(Type serviceType); - } + public class AutoMockedInstanceManager : InstanceManager { Modified: trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs =================================================================== --- trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs 2007-12-22 17:45:18 UTC (rev 50) +++ trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs 2007-12-30 16:31:10 UTC (rev 51) @@ -1,46 +1,61 @@ using System; using System.Collections.Generic; +using System.Reflection; using Rhino.Mocks; +using StructureMap.Graph; namespace StructureMap.AutoMocking { public delegate void GenericVoidMethod<TARGETCLASS>(TARGETCLASS target); public delegate void VoidMethod(); - public class RhinoAutoMocker : MockRepository, ServiceLocator + + + + public class RhinoAutoMocker<TARGETCLASS> : MockRepository where TARGETCLASS : class { - private Dictionary<Type, object> _services; private AutoMockedInstanceManager _manager; public RhinoAutoMocker() { - _services = new Dictionary<Type, object>(); - _manager = new AutoMockedInstanceManager(this); + + RhinoMocksServiceLocator locator = new RhinoMocksServiceLocator(this); + _manager = new AutoMockedInstanceManager(locator); + } - public TARGETCLASS Create<TARGETCLASS>() + public TARGETCLASS Create() { - throw new NotImplementedException(); + return _manager.FillDependencies<TARGETCLASS>(); } - public T Service<T>() + public TARGETCLASS CreatePartialMocked() { - throw new NotImplementedException(); + return PartialMock<TARGETCLASS>(getConstructorArgs()); } - public T UsePartialMock<T>() + private object[] getConstructorArgs() { - throw new NotImplementedException(); + ConstructorInfo ctor = Plugin.GetGreediestConstructor(typeof(TARGETCLASS)); + List<object> list = new List<object>(); + foreach (ParameterInfo parameterInfo in ctor.GetParameters()) + { + Type dependencyType = parameterInfo.ParameterType; + object dependency = _manager.CreateInstance(dependencyType); + list.Add(dependency); + } + + return list.ToArray(); } - public void Inject<T>(T stub) + public T Service<T>() { - throw new NotImplementedException(); + return _manager.CreateInstance<T>(); } - public object Service(Type serviceType) + public void InjectStub<T>(T stub) { - throw new NotImplementedException(); + _manager.InjectStub<T>(stub); } } } Added: trunk/Source/StructureMap.AutoMocking/RhinoMocksServiceLocator.cs =================================================================== --- trunk/Source/StructureMap.AutoMocking/RhinoMocksServiceLocator.cs (rev 0) +++ trunk/Source/StructureMap.AutoMocking/RhinoMocksServiceLocator.cs 2007-12-30 16:31:10 UTC (rev 51) @@ -0,0 +1,30 @@ +using System; +using Rhino.Mocks; + +namespace StructureMap.AutoMocking +{ + public class RhinoMocksServiceLocator : ServiceLocator + { + private readonly MockRepository _mocks; + + public RhinoMocksServiceLocator(MockRepository mocks) + { + _mocks = mocks; + } + + + public RhinoMocksServiceLocator() : this(new MockRepository()) + { + } + + public T Service<T>() + { + return _mocks.CreateMock<T>(); + } + + public object Service(Type serviceType) + { + return _mocks.CreateMock(serviceType); + } + } +} \ No newline at end of file Added: trunk/Source/StructureMap.AutoMocking/ServiceLocator.cs =================================================================== --- trunk/Source/StructureMap.AutoMocking/ServiceLocator.cs (rev 0) +++ trunk/Source/StructureMap.AutoMocking/ServiceLocator.cs 2007-12-30 16:31:10 UTC (rev 51) @@ -0,0 +1,10 @@ +using System; + +namespace StructureMap.AutoMocking +{ + public interface ServiceLocator + { + T Service<T>(); + object Service(Type serviceType); + } +} \ No newline at end of file Modified: trunk/Source/StructureMap.AutoMocking/StructureMap.AutoMocking.csproj =================================================================== --- trunk/Source/StructureMap.AutoMocking/StructureMap.AutoMocking.csproj 2007-12-22 17:45:18 UTC (rev 50) +++ trunk/Source/StructureMap.AutoMocking/StructureMap.AutoMocking.csproj 2007-12-30 16:31:10 UTC (rev 51) @@ -43,6 +43,8 @@ <Compile Include="AutoMockedInstanceManager.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="RhinoAutoMocker.cs" /> + <Compile Include="RhinoMocksServiceLocator.cs" /> + <Compile Include="ServiceLocator.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\StructureMap\StructureMap.csproj"> Property changes on: trunk/Source/StructureMap.Testing ___________________________________________________________________ Name: svn:ignore - bin obj *.csproj.user + bin obj *.csproj.user [Bb]in [Dd]ebug [Rr]elease *.user *.aps *.eto Modified: trunk/Source/StructureMap.Testing/AutoMocking/RhinoAutoMockerTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/AutoMocking/RhinoAutoMockerTester.cs 2007-12-22 17:45:18 UTC (rev 50) +++ trunk/Source/StructureMap.Testing/AutoMocking/RhinoAutoMockerTester.cs 2007-12-30 16:31:10 UTC (rev 51) @@ -1,14 +1,215 @@ +using System; using NUnit.Framework; using Rhino.Mocks; +using Rhino.Mocks.Impl; +using Rhino.Mocks.Interfaces; +using StructureMap.AutoMocking; namespace StructureMap.Testing.AutoMocking { [TestFixture] public class RhinoAutoMockerTester { + private MockRepository _mocks; + private RhinoMocksServiceLocator _locator; + private AutoMockedInstanceManager _instanceManager; + [SetUp] public void SetUp() { + _mocks = new MockRepository(); + _locator = new RhinoMocksServiceLocator(_mocks); + _instanceManager = new AutoMockedInstanceManager(_locator); } + + [Test] + public void GetAFullMockForAServiceThatHasNotPreviouslyBeenRequested() + { + IMockedService service = _instanceManager.CreateInstance<IMockedService>(); + + + Assert.IsNotNull(service); + IMockedObject instance = (IMockedObject)service; + Assert.AreSame(_mocks, instance.Repository); + } + + [Test] + public void RequestTheServiceTwiceAndGetTheExactSameMockObject() + { + IMockedService service = _instanceManager.CreateInstance<IMockedService>(); + Assert.AreSame(service, _instanceManager.CreateInstance<IMockedService>()); + Assert.AreSame(service, _instanceManager.CreateInstance<IMockedService>()); + Assert.AreSame(service, _instanceManager.CreateInstance<IMockedService>()); + Assert.AreSame(service, _instanceManager.CreateInstance<IMockedService>()); + } + + [Test] + public void InjectAStubAndGetTheStubBack() + { + StubService stub = new StubService(); + _instanceManager.InjectStub<IMockedService>(stub); + + Assert.AreSame(stub, _instanceManager.CreateInstance<IMockedService>()); + Assert.AreSame(stub, _instanceManager.CreateInstance<IMockedService>()); + Assert.AreSame(stub, _instanceManager.CreateInstance<IMockedService>()); + } + + [Test] + public void AutoFillAConcreteClassWithMocks() + { + IMockedService service = _instanceManager.CreateInstance<IMockedService>(); + IMockedService2 service2 = _instanceManager.CreateInstance<IMockedService2>(); + IMockedService3 service3 = _instanceManager.CreateInstance<IMockedService3>(); + + ConcreteClass concreteClass = _instanceManager.FillDependencies<ConcreteClass>(); + Assert.AreSame(service, concreteClass.Service); + Assert.AreSame(service2, concreteClass.Service2); + Assert.AreSame(service3, concreteClass.Service3); + } + + [Test] + public void UseTheAutoMockerToStartUpTheConcreteClass() + { + RhinoAutoMocker<ConcreteClass> autoMocker = new RhinoAutoMocker<ConcreteClass>(); + + using (autoMocker.Record()) + { + Expect.Call(autoMocker.Service<IMockedService>().Name).Return("Jeremy"); + } + + Assert.AreEqual("Jeremy", autoMocker.Create().Name); + } + + [Test] + public void UseTheAutoMockerToStartUpTheConcreteClassAsAPartialMockAndSetTheNameMethodUp() + { + RhinoAutoMocker<ConcreteClass> autoMocker = new RhinoAutoMocker<ConcreteClass>(); + + ConcreteClass concreteClass = autoMocker.CreatePartialMocked(); + + using (autoMocker.Record()) + { + Expect.Call(concreteClass.Name).Return("Max"); + } + + Assert.AreEqual("Max", concreteClass.Name); + } + + [Test] + public void TheAutoMockerPushesInMocksForAllOfTheConstructorArgumentsForAPartialMock() + { + RhinoAutoMocker<ConcreteClass> autoMocker = new RhinoAutoMocker<ConcreteClass>(); + + IMockedService service = autoMocker.Service<IMockedService>(); + IMockedService2 service2 = autoMocker.Service<IMockedService2>(); + IMockedService3 service3 = autoMocker.Service<IMockedService3>(); + + ConcreteClass concreteClass = autoMocker.CreatePartialMocked(); + + Assert.AreSame(service, concreteClass.Service); + Assert.AreSame(service2, concreteClass.Service2); + Assert.AreSame(service3, concreteClass.Service3); + } + + + [Test] + public void TheAutoMockerPushesInMocksAndAPreBuiltStubForAllOfTheConstructorArguments() + { + RhinoAutoMocker<ConcreteClass> autoMocker = new RhinoAutoMocker<ConcreteClass>(); + StubService stub = new StubService(); + autoMocker.InjectStub<IMockedService>(stub); + + IMockedService2 service2 = autoMocker.Service<IMockedService2>(); + IMockedService3 service3 = autoMocker.Service<IMockedService3>(); + + ConcreteClass concreteClass = autoMocker.Create(); + + Assert.AreSame(stub, concreteClass.Service); + Assert.AreSame(service2, concreteClass.Service2); + Assert.AreSame(service3, concreteClass.Service3); + } + + + public class ConcreteClass + { + private readonly IMockedService _service; + private readonly IMockedService2 _service2; + private readonly IMockedService3 _service3; + + public ConcreteClass(IMockedService service, IMockedService2 service2, IMockedService3 service3) + { + _service = service; + _service2 = service2; + _service3 = service3; + } + + public virtual string Name + { + get + { + return _service.Name; + } + } + + public IMockedService Service + { + get { return _service; } + } + + public IMockedService2 Service2 + { + get { return _service2; } + } + + public IMockedService3 Service3 + { + get { return _service3; } + } + } + + public interface IMockedService + { + void Go(); + string Name { get;} + } + + public interface IMockedService2 + { + void Go(); + } + + public interface IMockedService3 + { + void Go(); + } + + + + public class StubService : IMockedService + { + private readonly string _name; + + public StubService() + { + } + + public StubService(string name) + { + _name = name; + } + + + public string Name + { + get { return _name; } + } + + public void Go() + { + throw new NotImplementedException(); + } + } } + + } Modified: trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj =================================================================== --- trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj 2007-12-22 17:45:18 UTC (rev 50) +++ trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj 2007-12-30 16:31:10 UTC (rev 51) @@ -99,6 +99,10 @@ <Reference Include="System.Xml"> <Name>System.XML</Name> </Reference> + <ProjectReference Include="..\StructureMap.AutoMocking\StructureMap.AutoMocking.csproj"> + <Project>{0ED1B206-A1C9-4A52-BA87-3BA416C8725C}</Project> + <Name>StructureMap.AutoMocking</Name> + </ProjectReference> <ProjectReference Include="..\StructureMap.Client\StructureMap.Client.csproj"> <Name>StructureMap.Client</Name> <Project>{887C4441-07A4-489D-B8D9-EFE9D28A47CA}</Project> Modified: trunk/bin/Rhino.Mocks.dll =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2008-06-23 17:44:03
|
Revision: 125 http://structuremap.svn.sourceforge.net/structuremap/?rev=125&view=rev Author: jeremydmiller Date: 2008-06-23 10:44:01 -0700 (Mon, 23 Jun 2008) Log Message: ----------- docs Modified Paths: -------------- trunk/Source/HTML/HTML.csproj trunk/Source/StructureMap/Configuration/PrimitiveArrayReader.cs trunk/Source/StructureMap/Container.cs trunk/Source/StructureMap/ExplicitArgsExpression.cs trunk/Source/StructureMap/IContainer.cs trunk/Source/StructureMap/ObjectFactory.cs trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs trunk/Source/StructureMap.Testing/AutoMocking/RhinoAutoMockerTester.cs trunk/Source/StructureMap.Testing/Configuration/DictionaryAndArrayArgumentTester.cs trunk/Source/StructureMap.Testing/Configuration/PrimitiveArrayReaderTester.cs trunk/Source/StructureMap.Testing/Graph/ContainerTester.cs trunk/Source/StructureMap.Testing/Graph/ExplicitArgumentTester.cs trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj trunk/Source/StructureMap.Testing/TestData/StructureMap.config trunk/Source/StructureMap.Testing.Widget5/OtherGridColumn.cs trunk/Source/StructureMap.sln Added Paths: ----------- trunk/Source/HTML/AttributeNormalized.htm trunk/Source/HTML/AutoMocking.htm trunk/Source/HTML/BestPractices.htm trunk/Source/HTML/ChangingDefaultsAtRuntime.htm trunk/Source/HTML/CompositeConfiguration.htm trunk/Source/HTML/Concepts.htm trunk/Source/HTML/ConcreteTypes.htm trunk/Source/HTML/ConfigurationArchitecture.htm trunk/Source/HTML/ConfiguringStructureMap.htm trunk/Source/HTML/ConstructorAndSetterInjection.htm trunk/Source/HTML/CreatingContainer.htm trunk/Source/HTML/Default.htm trunk/Source/HTML/Diagnostics.htm trunk/Source/HTML/EnvironmentTests.htm trunk/Source/HTML/ExtendingStructureMap.htm trunk/Source/HTML/FAQ.htm trunk/Source/HTML/FluentInterfaceAPI.htm trunk/Source/HTML/Generics.htm trunk/Source/HTML/GentleGuide.htm trunk/Source/HTML/HTML.csproj.user trunk/Source/HTML/ImplicitInstances.htm trunk/Source/HTML/InjectingServicesAtRuntime.htm trunk/Source/HTML/Interception.htm trunk/Source/HTML/NodeNormalized.htm trunk/Source/HTML/Profiles.htm trunk/Source/HTML/QuickStart.htm trunk/Source/HTML/RetrievingServices.htm trunk/Source/HTML/RuntimeArchitecture.htm trunk/Source/HTML/Sample.xml trunk/Source/HTML/ScanningAssemblies.htm trunk/Source/HTML/Scoping.htm trunk/Source/HTML/StructureMapAndMocks.htm trunk/Source/HTML/StructureMapDoctor.htm trunk/Source/HTML/TroubleShooting.htm trunk/Source/HTML/UsingStructureMapWithinUnitTests.htm trunk/Source/HTML/WhatWillStructureMapDoWhenI.htm trunk/Source/HTML/XmlConfiguration.htm trunk/Source/StructureMap.Testing/Examples.cs trunk/Source/StructureMap.sln.cache Removed Paths: ------------- trunk/Source/StructureMap/Delegates.cs Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Name: svn:ignore - build results + build results push.bat Added: trunk/Source/HTML/AttributeNormalized.htm =================================================================== --- trunk/Source/HTML/AttributeNormalized.htm (rev 0) +++ trunk/Source/HTML/AttributeNormalized.htm 2008-06-23 17:44:01 UTC (rev 125) @@ -0,0 +1,462 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> + <head> + <title>Title</title> + <link rel="stylesheet" type="text/css" href="style.css"> + <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"> + <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> + <style type="text/css"> + .style1 + { + font-weight: bold; + } + </style> + </head> + <body> + <h1>Attribute Normalized Xml Instances</h1> + <p>This style is a more terse configuration format that was + added in version 1.0. My recommendaton is to always use attribute normalized + Xml configuration by marking the <StructureMap> node with the + MementoStyle="Attribute" attribute by default anytime you are using Xml + configuration. </p> + <h4>Instance Root Node</h4> + <p>An Instance is defined in Xml starting from a root node. The actual name of + the root node varies depending upon the context that an Instance is being + configured. For example, the AddInstance, DefaultInstance, + PluginFamily/Instance, Interceptor, and Source nodes in Xml configuration are + all Instance roots. The rules for an Instance node are the same regardless + of the context. The root node optionally specifies the name of the + instance and the concrete type of the instance.</p> + <p>For a class called ColorRule,</p> +<!-- +{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red43\green145\blue175;\red163\green21\blue21;\red0\green0\blue255;}??\fs20 [\cf3 Pluggable\cf0 (\cf4 "Color"\cf0 )]\par ?? \cf5 public\cf0 \cf5 class\cf0 \cf3 ColorRule\cf0 : \cf3 Rule\par ??\cf0 \{\par ?? \cf5 private\cf0 \cf5 string\cf0 _Color;\par ?? \cf5 public\cf0 \cf5 string\cf0 ID = \cf3 Guid\cf0 .NewGuid().ToString();\par ??\par ?? \cf5 public\cf0 ColorRule(\cf5 string\cf0 Color)\par ?? \{\par ?? _Color = Color;\par ?? \}\par ??\par ??\par ?? \cf5 public\cf0 \cf5 string\cf0 Color\par ?? \{\par ?? \cf5 get\cf0 \{ \cf5 return\cf0 _Color; \}\par ?? \}\par ?? \}} +--> + <div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"> + <p style="margin: 0px;"> + [<span style="color: #2b91af;">Pluggable</span>(<span + style="color: #a31515;">"Color"</span>)]</p> + <p style="margin: 0px;"> + <span style="color: blue;">public</span> <span style="color: blue;">class</span> + <span style="color: #2b91af;">ColorRule</span> : <span style="color: #2b91af;"> + Rule</span></p> + <p style="margin: 0px;"> + {</p> + <p style="margin: 0px;"> + <span style="color: blue;">private</span> + <span style="color: blue;">string</span> _Color;</p> + <p style="margin: 0px;"> + <span style="color: blue;">public</span> + <span style="color: blue;">string</span> ID = <span style="color: #2b91af;">Guid</span>.NewGuid().ToString();</p> + <p style="margin: 0px;"> + </p> + <p style="margin: 0px;"> + <span style="color: blue;">public</span> + ColorRule(<span style="color: blue;">string</span> Color)</p> + <p style="margin: 0px;"> + {</p> + <p style="margin: 0px;"> + _Color = Color;</p> + <p style="margin: 0px;"> + }</p> + <p style="margin: 0px;"> + </p> + <p style="margin: 0px;"> + </p> + <p style="margin: 0px;"> + <span style="color: blue;">public</span> + <span style="color: blue;">string</span> Color</p> + <p style="margin: 0px;"> + {</p> + <p style="margin: 0px;"> + + <span style="color: blue;">get</span> { <span style="color: blue;">return</span> + _Color; }</p> + <p style="margin: 0px;"> + }</p> + <p style="margin: 0px;"> + }</p> + </div> +<!--EndFragment--> +<p>an Instance node might look like:</p> +<!-- +{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red163\green21\blue21;\red255\green0\blue0;\red0\green0\blue0;}??\fs20 \cf1 <\cf3 Instance\cf1 \cf4 Key\cf1 =\cf0 "\cf1 Red\cf0 "\cf1 \cf4 Type\cf1 =\cf0 "\cf1 Color\cf0 "\cf1 \cf4 Color\cf1 =\cf0 "\cf1 Red\cf0 "\cf1 />} +--> + <div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"> + <p style="margin: 0px;"> + <span style="color: blue;"> <</span><span + style="color: #a31515;">Instance</span><span style="color: blue;"> </span> + <span style="color: red;">Key</span><span style="color: blue;">=</span>"<span + style="color: blue;">Red</span>"<span style="color: blue;"> </span> + <span style="color: red;">Type</span><span style="color: blue;">=</span>"<span + style="color: blue;">Color</span>"<span style="color: blue;"> </span> + <span style="color: red;">Color</span><span style="color: blue;">=</span>"<span + style="color: blue;">Red</span>"<span style="color: blue;"> /></span></p> + </div> +<!--EndFragment--> +<p>The "name" of an Instance is definied by the Key attribute. The concrete + type can be specified in one of two ways. You can either use the "Type" + attribute above to specify the aliased concrete type, or do it more explicitly + by setting the PluggedType attribute to the assembly qualified name of the + concrete type.</p> +<!-- +{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red163\green21\blue21;\red255\green0\blue0;\red0\green0\blue0;}??\fs20 \cf1 <\cf3 Instance\cf1 \cf4 Key\cf1 =\cf0 "\cf1 Red\cf0 "\cf1 \cf4 PluggedType\cf1 =\cf0 "\cf1 StructureMap.Testing.Widget.Color, StructureMap.Testing.Widget\cf0 "\cf1 \cf4 Color\cf1 =\cf0 "\cf1 Red\cf0 "\cf1 />} +--> + <div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"> + <p style="margin: 0px;"> + <span style="color: blue;"> <</span><span + style="color: #a31515;">Instance</span><span style="color: blue;"> </span> + <span style="color: red;">Key</span><span style="color: blue;">=</span>"<span + style="color: blue;">Red</span>"<span style="color: blue;"> </span> + <span style="color: red;">PluggedType</span><span style="color: blue;">=</span>"<span + style="color: blue;">StructureMap.Testing.Widget.Color, + StructureMap.Testing.Widget</span>"<span style="color: blue;"> </span> + <span style="color: red;">Color</span><span style="color: blue;">=</span>"<span + style="color: blue;">Red</span>"<span style="color: blue;"> /></span></p> +</div> +<!--EndFragment--> +<p> </p> + <h4>Primitive Properties (Strings and basic value types)</h4> + <p>Primitive constructor or setter arguments are defined by + adding an attribute @propertyName="propertyValue" to the + instance node.="font-family: Courier New; font-size: 10pt; color: black; background: white; border-top: windowtext 1pt solid; padding-top: 0pt; border-left: windowtext 1pt solid; padding-left: 0pt; border-right: windowtext 1pt solid; padding-right: 0pt; border-bottom: windowtext 1pt solid; padding-bottom: 0pt;"> +<pre style="margin: 0px;"> [Pluggable("Color", "Only for testing")]</pre> +<pre style="margin: 0px;"> <span style="color: blue;">public</span> <span style="color: blue;">class</span> ColorWidget : IWidget</pre> +<pre style="margin: 0px;"> {</pre> +<pre style="margin: 0px;"> <span style="color: blue;">public</span> ColorWidget(<span style="color: blue;">string</span> Color)</pre> +<pre style="margin: 0px;"> {</pre> +<pre style="margin: 0px;"> _Color = Color;</pre> +<pre style="margin: 0px;"> }</pre> +<pre style="margin: 0px;"> }</pre> +</div> +<br> +<div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border-top: windowtext 1pt solid; padding-top: 0pt; border-left: windowtext 1pt solid; padding-left: 0pt; border-right: windowtext 1pt solid; padding-right: 0pt; border-bottom: windowtext 1pt solid; padding-bottom: 0pt;"> +<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: maroon;">Widget</span><span style="color: fuchsia;"> </span><span style="color: red;">Type</span><span style="color: blue;">="Color"</span><span style="color: fuchsia;"> </span><span style="color: red;">Key</span><span style="color: blue;">="Red"</span><span style="color: fuchsia;"> </span><span style="color: #FF0000">Color</span><span style="color: blue;">="Red" /></span></pre> +</div> + +<h4>Long Strings</h4> + <p>There is an optional mode to define a property value + inside a CDATA tag for very long strings like sql statements + or Javascript templates. </p> +<div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border-top: windowtext 1pt solid; padding-top: 0pt; border-left: windowtext 1pt solid; padding-left: 0pt; border-right: windowtext 1pt solid; padding-right: 0pt; border-bottom: windowtext 1pt solid; padding-bottom: 0pt;"> +<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: #800000">Instance </span><span style="color: red;">Type</span><span style="color: blue;">="Sql"</span><span style="color: fuchsia;"> </span><span style="color: red;">Key</span><span style="color: blue;">="SomeQuery"></span></pre> +<pre style="margin: 0px;"><span style="color: blue;"> <bigProp></span></pre> +<pre style="margin: 0px;"> <span style="color: blue;"><![</span><span style="color: fuchsia;">CDATA[</span></pre> +<pre style="margin: 0px;"><span style="color: fuchsia;"> select </span><span style="color: blue;">*</span><span style="color: fuchsia;"> from table</span></pre> +<pre style="margin: 0px;"><span style="color: fuchsia;"> where</span></pre> +<pre style="margin: 0px;"><span style="color: fuchsia;"> somecolumn = </span><span style="color: blue;">'something'</span><span style="color: fuchsia;"> or</span></pre> +<pre style="margin: 0px;"><span style="color: fuchsia;"> some_other_column = </span><span style="color: blue;">'something else'</span></pre> +<pre style="margin: 0px;"><span style="color: fuchsia;"> </span><span style="color: blue;">]]></span></pre> +<pre style="margin: 0px;"><span style="color: #0000FF"> </span><span style="color: blue;"></</span><span style="color: #800000">bigProp</span><span style="color: blue;">></span></pre> +<pre style="margin: 0px;"> <span style="color: blue;"></</span><span style="color: maroon;">Property</span><span style="color: blue;">></span></pre> +</div> + + <h4>Enumeration Properties</h4> + <p>Enumeration arguments are defined the same way as + primitive properties. Use the string names of the + enumeration for the values.</p> +<div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border-top: windowtext 1pt solid; padding-top: 0pt; border-left: windowtext 1pt solid; padding-left: 0pt; border-right: windowtext 1pt solid; padding-right: 0pt; border-bottom: windowtext 1pt solid; padding-bottom: 0pt;"> +<pre style="margin: 0px;"> <span style="color: blue;">public</span> <span style="color: blue;">enum</span> BreedEnum</pre> +<pre style="margin: 0px;"> {</pre> +<pre style="margin: 0px;"> Hereford,</pre> +<pre style="margin: 0px;"> Angus,</pre> +<pre style="margin: 0px;"> Longhorn</pre> +<pre style="margin: 0px;"> }</pre> +<pre style="margin: 0px;"> </pre> +<pre style="margin: 0px;"> [Pluggable("Cow")]</pre> +<pre style="margin: 0px;"> <span style="color: blue;">public</span> <span style="color: blue;">class</span> Cow</pre> +<pre style="margin: 0px;"> {</pre> +<pre style="margin: 0px;"> <span style="color: blue;">public</span> BreedEnum Breed;</pre> +<pre style="margin: 0px;"> <span style="color: blue;">public</span> <span style="color: blue;">long</span> Weight;</pre> +<pre style="margin: 0px;"> <span style="color: blue;">public</span> <span style="color: blue;">string</span> Name;</pre> +<pre style="margin: 0px;"> </pre> +<pre style="margin: 0px;"> <span style="color: blue;">public</span> Cow(<span style="color: blue;">long</span> Weight, BreedEnum Breed, <span style="color: blue;">string</span> Name)</pre> +<pre style="margin: 0px;"> {</pre> +<pre style="margin: 0px;"> <span style="color: blue;">this</span>.Breed = Breed;</pre> +<pre style="margin: 0px;"> <span style="color: blue;">this</span>.Weight = Weight;</pre> +<pre style="margin: 0px;"> <span style="color: blue;">this</span>.Name = Name;</pre> +<pre style="margin: 0px;"> }</pre> +<pre style="margin: 0px;"> }</pre> +</div> +<br> +<div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border-top: windowtext 1pt solid; padding-top: 0pt; border-left: windowtext 1pt solid; padding-left: 0pt; border-right: windowtext 1pt solid; padding-right: 0pt; border-bottom: windowtext 1pt solid; padding-bottom: 0pt;"> +<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: #800000">Instance</span><span style="color: fuchsia;"> </span><span style="color: red;">Type</span><span style="color: blue;">="Cow"</span><span style="color: fuchsia;"> </span><span style="color: red;">Key</span><span style="color: blue;">="Maggie" </span><span style="color: #FF0000">Breed</span><span style="color: blue;">="Angus" /></span></pre> +</div> + <h4>Child Properties</h4> + <p>Child properties of non-primitive types are defined as + embedded memento nodes. Child properties can be either + defined inline or use a reference to a named instance of the + property type. If a child property is omitted or + defined with no value, StructureMap will use the default + instance of the property type. Simply add a child node to the main instance + node with the name of the constructor argument or setter property name.</p> +<div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border-top: windowtext 1pt solid; padding-top: 0pt; border-left: windowtext 1pt solid; padding-left: 0pt; border-right: windowtext 1pt solid; padding-right: 0pt; border-bottom: windowtext 1pt solid; padding-bottom: 0pt;"> +<pre style="margin: 0px;"> [PluginFamily, Pluggable("Default", "")]</pre> +<pre style="margin: 0px;"> <span style="color: blue;">public</span> <span style="color: blue;">class</span> GrandChild</pre> +<pre style="margin: 0px;"> {</pre> +<pre style="margin: 0px;"> <span style="color: blue;">public</span> GrandChild(<span style="color: blue;">bool</span> RightHanded, <span style="color: blue;">int</span> BirthYear)</pre> +<pre style="margin: 0px;"> {</pre> +<pre style="margin: 0px;"> }</pre> +<pre style="margin: 0px;"> }</pre> +<pre style="margin: 0px;"> </pre> +<pre style="margin: 0px;"> </pre> +<pre style="margin: 0px;"> [Pluggable("Leftie", "")]</pre> +<pre style="margin: 0px;"> <span style="color: blue;">public</span> <span style="color: blue;">class</span> LeftieGrandChild : GrandChild</pre> +<pre style="margin: 0px;"> {</pre> +<pre style="margin: 0px;"> <span style="color: blue;">public</span> LeftieGrandChild(<span style="color: blue;">int</span> BirthYear) : <span style="color: blue;">base</span>(<span style="color: blue;">false</span>, BirthYear)</pre> +<pre style="margin: 0px;"> {</pre> +<pre style="margin: 0px;"> }</pre> +<pre style="margin: 0px;"> }</pre> +<pre style="margin: 0px;"> </pre> +<pre style="margin: 0px;"> </pre> +<pre style="margin: 0px;"> [PluginFamily, Pluggable("Default", "")]</pre> +<pre style="margin: 0px;"> <span style="color: blue;">public</span> <span style="color: blue;">class</span> Child</pre> +<pre style="margin: 0px;"> {</pre> +<pre style="margin: 0px;"> <span style="color: blue;">public</span> Child(<span style="color: blue;">string</span> Name, GrandChild MyGrandChild)</pre> +<pre style="margin: 0px;"> {</pre> +<pre style="margin: 0px;"> }</pre> +<pre style="margin: 0px;"> }</pre> +</div> +<br> +<h4>Inline Definition</h4> +<div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border-top: windowtext 1pt solid; padding-top: 0pt; border-left: windowtext 1pt solid; padding-left: 0pt; border-right: windowtext 1pt solid; padding-right: 0pt; border-bottom: windowtext 1pt solid; padding-bottom: 0pt;"> +<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: maroon;">StructureMap.Testing.Widget.Child</span><span style="color: fuchsia;"> </span><span style="color: red;">Type</span><span style="color: blue;">="Default"</span><span style="color: fuchsia;"> </span><span style="color: red;">Key</span><span style="color: blue;">="Tom" </span><span style="color: red;">Name</span><span style="color: blue;">="Tom"></span></pre> +<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: maroon;">MyGrandChild</span><span style="color: fuchsia;"> </span><span style="color: red;">Name</span><span style="color: blue;">="MyGrandChild"</span><span style="color: fuchsia;"> </span><span style="color: red;">Type</span><span style="color: blue;">="Leftie" </span><span style="color: #FF0000">BirthYear</span><span style="color: blue;">="1984" /></span></pre> +<pre style="margin: 0px;"> <span style="color: blue;"></</span><span style="color: maroon;">StructureMap.Testing.Widget.Child</span><span style="color: blue;">></span></pre> +</div> +<h4>Reference Definition</h4> +<div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border-top: windowtext 1pt solid; padding-top: 0pt; border-left: windowtext 1pt solid; padding-left: 0pt; border-right: windowtext 1pt solid; padding-right: 0pt; border-bottom: windowtext 1pt solid; padding-bottom: 0pt;"> +<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: maroon;">StructureMap.Testing.Widget.Child</span><span style="color: fuchsia;"> </span><span style="color: red;">Type</span><span style="color: blue;">="Default"</span><span style="color: fuchsia;"> </span><span style="color: red;">Key</span><span style="color: blue;">="Marsha" </span><span style="color: red;">Name</span><span style="color: blue;">="Marsha"></span></pre> +<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: maroon;">MyGrandChild</span><span style="color: fuchsia;"> </span><span style="color: red;">Key</span><span style="color: blue;">="Tommy"/></span></pre> +<pre style="margin: 0px;"> <span style="color: blue;"></</span><span style="color: maroon;">StructureMap.Testing.Widget.Child</span><span style="color: blue;">></span> </pre> +</div> +<h3>Non Primitive Array Property</h3> +<p>If a property or constructor argument is an array of a non-primitive type, create + a child node to the top level instance node with the name of the property. + Simply add new InstanceMemento nodes with the name <Child> under the property + nodes for each element of the array. These <Child> nodes are Attribute + Normalized InstanceMemento's and follow the same rules expressed in this + document.</p> +<div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border-top: windowtext 1pt solid; padding-top: 0pt; border-left: windowtext 1pt solid; padding-left: 0pt; border-right: windowtext 1pt solid; padding-right: 0pt; border-bottom: windowtext 1pt solid; padding-bottom: 0pt;"> +<pre style="margin: 0px;"> [Pluggable("Compound")]</pre> +<pre style="margin: 0px;"> <span style="color: blue;">public</span> <span style="color: blue;">class</span> CompoundStrategy : IStrategy</pre> +<pre style="margin: 0px;"> {</pre> +<pre style="margin: 0px;"> <span style="color: blue;">public</span> CompoundStrategy(IStrategy[] innerStrategies)</pre> +<pre style="margin: 0px;"> {</pre> +<pre style="margin: 0px;"> }</pre> +<pre style="margin: 0px;"> }</pre> +</div> +<br> +<div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border-top: windowtext 1pt solid; padding-top: 0pt; border-left: windowtext 1pt solid; padding-left: 0pt; border-right: windowtext 1pt solid; padding-right: 0pt; border-bottom: windowtext 1pt solid; padding-bottom: 0pt;"> +<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: maroon;">Instance</span><span style="color: fuchsia;"> </span><span style="color: red;">Key</span><span style="color: blue;">="ArrayTest"</span><span style="color: fuchsia;"> </span><span style="color: red;">Type</span><span style="color: blue;">="Compound"></span></pre> +<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: maroon;">innerStrategies</span><span style="color: blue;">></span></pre> +<pre style="margin: 0px;"> <span style="color: blue;"><!</span><span style="color: green;">-- Referenced Instance --</span><span style="color: blue;">></span></pre> +<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: #800000">Child</span><span style="color: fuchsia;"> </span><span style="color: red;">Key</span><span style="color: blue;">="Red" /></span></pre> +<pre style="margin: 0px;"> </pre> +<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: #800000">Child</span><span style="color: blue;">><!</span><span style="color: green;">-- Default Instance --</span><span style="color: blue;">></</span><span style="color: #800000">Child</span><span style="color: blue;">></span></pre> +<pre style="margin: 0px;"> </pre> +<pre style="margin: 0px;"> <span style="color: blue;"><!</span><span style="color: green;">-- Inline Definition --</span><span style="color: blue;">></span></pre> +<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: #800000">Child</span><span style="color: fuchsia;"> </span><span style="color: red;">Type</span><span style="color: blue;">="Random" </span><span style="color: #FF0000">seed</span><span style="color: blue;">="0.034"/></span></pre> +<pre style="margin: 0px;"> <span style="color: blue;"></</span><span style="color: maroon;">innerStrategies</span><span style="color: blue;">></span></pre> +<pre style="margin: 0px;"> <span style="color: blue;"></</span><span style="color: maroon;">Instance</span><span style="color: blue;">></span></pre> +</div> +<h3>Primitive Arrays</h3> + <p>Primitive arrays like string[] or int[] can be defined in Xml. For a class + with arguments like:</p> +<!-- +{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red0\green0\blue255;}??\fs20 \cf3 public\cf0 ClassWithStringAndIntArray(\cf3 int\cf0 [] numbers, \cf3 string\cf0 [] strings)\par ?? \{\par ?? _numbers = numbers;\par ?? _strings = strings;\par ?? \}} +--> + <div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"> + <p style="margin: 0px;"> + <span style="color: blue;">public</span> + ClassWithStringAndIntArray(<span style="color: blue;">int</span>[] numbers, + <span style="color: blue;">string</span>[] strings)</p> + <p style="margin: 0px;"> + {</p> + <p style="margin: 0px;"> + _numbers = numbers;</p> + <p style="margin: 0px;"> + _strings = strings;</p> + <p style="margin: 0px;"> + }</p> + </div> +<!--EndFragment--> +<p>The Xml configuration is:</p> +<!-- +{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red163\green21\blue21;\red255\green0\blue0;\red0\green0\blue0;}??\fs20 \cf1 <\cf3 DefaultInstance\par ??\cf1 \cf4 PluginType\cf1 =\cf0 "\cf1 StructureMap.Testing.Configuration.ClassWithStringAndIntArray, StructureMap.Testing\cf0 "\par ??\cf1 \cf4 PluggedType\cf1 =\cf0 "\cf1 StructureMap.Testing.Configuration.ClassWithStringAndIntArray, StructureMap.Testing\cf0 "\cf1 >\par ??\par ?? <\cf3 numbers\cf1 \cf4 Values\cf1 =\cf0 "\cf1 1,2,3\cf0 "\cf1 />\par ?? <\cf3 strings\cf1 \cf4 Values\cf1 =\cf0 "\cf1 1,2,3\cf0 "\cf1 />\par ?? </\cf3 DefaultInstance\cf1 >} +--> + <div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"> + <p style="margin: 0px;"> + <span style="color: blue;"> <</span><span style="color: #a31515;">DefaultInstance</span></p> + <p style="margin: 0px;"> + <span style="color: blue;"> </span><span style="color: red;"> + PluginType</span><span style="color: blue;">=</span>"<span style="color: blue;">StructureMap.Testing.Configuration.ClassWithStringAndIntArray, + StructureMap.Testing</span>"</p> + <p style="margin: 0px;"> + <span style="color: blue;"> </span><span style="color: red;"> + PluggedType</span><span style="color: blue;">=</span>"<span + style="color: blue;">StructureMap.Testing.Configuration.ClassWithStringAndIntArray, + StructureMap.Testing</span>"<span style="color: blue;">></span></p> + <p style="margin: 0px;"> + </p> + <p style="margin: 0px;"> + <span class="style1" style="color: blue;"> <</span><span + class="style1" style="color: #a31515;">numbers</span><span class="style1" + style="color: blue;"> </span><span class="style1" style="color: red;">Values</span><span + class="style1" style="color: blue;">=</span>"<span class="style1" + style="color: blue;">1,2,3</span>"<span class="style1" style="color: blue;">/></span></p> + <p style="margin: 0px;"> + <span class="style1" style="color: blue;"> <</span><span + class="style1" style="color: #a31515;">strings</span><span class="style1" + style="color: blue;"> </span><span class="style1" style="color: red;">Values</span><span + class="style1" style="color: blue;">=</span>"<span class="style1" + style="color: blue;">1,2,3</span>"<span class="style1" style="color: blue;">/></span></p> + <p style="margin: 0px;"> + <span style="color: blue;"> </</span><span style="color: #a31515;">DefaultInstance</span><span + style="color: blue;">></span></p> + </div> +<!--EndFragment--> +<p>By default, the Values attribute is assumed to be a comma delimited list. + The delimiter of the list can be optionally overriden by using the Delimiter + attribute.</p> +<!-- +{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red163\green21\blue21;\red255\green0\blue0;\red0\green0\blue0;}??\fs20 \cf1 <\cf3 DefaultInstance\par ??\cf1 \cf4 PluginType\cf1 =\cf0 "\cf1 StructureMap.Testing.Configuration.ClassWithStringAndIntArray, StructureMap.Testing\cf0 "\par ??\cf1 \cf4 PluggedType\cf1 =\cf0 "\cf1 StructureMap.Testing.Configuration.ClassWithStringAndIntArray, StructureMap.Testing\cf0 "\cf1 >\par ??\par ?? <\cf3 numbers\cf1 \cf4 Values\cf1 =\cf0 "\cf1 1;2;3\cf0 "\cf1 \cf4 Delimiter\cf1 =\cf0 "\cf1 ;\cf0 "\cf1 />\par ?? <\cf3 strings\cf1 \cf4 Values\cf1 =\cf0 "\cf1 1,2,3\cf0 "\cf1 />\par ?? </\cf3 DefaultInstance\cf1 >} +--> +<div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"> + <p style="margin: 0px;"> + <span style="color: blue;"> <</span><span style="color: #a31515;">DefaultInstance</span></p> + <p style="margin: 0px;"> + <span style="color: blue;"> </span><span style="color: red;"> + PluginType</span><span style="color: blue;">=</span>"<span style="color: blue;">StructureMap.Testing.Configuration.ClassWithStringAndIntArray, + StructureMap.Testing</span>"</p> + <p style="margin: 0px;"> + <span style="color: blue;"> </span><span style="color: red;"> + PluggedType</span><span style="color: blue;">=</span>"<span + style="color: blue;">StructureMap.Testing.Configuration.ClassWithStringAndIntArray, + StructureMap.Testing</span>"<span style="color: blue;">></span></p> + <p style="margin: 0px;"> + </p> + <p style="margin: 0px;"> + <span style="color: blue;"> <</span><span + style="color: #a31515;">numbers</span><span style="color: blue;"> </span> + <span style="color: red;">Values</span><span style="color: blue;">=</span>"<span + style="color: blue;">1;2;3</span>"<span style="color: blue;"> </span> + <span style="color: red;">Delimiter</span><span style="color: blue;">=</span>"<span + style="color: blue;">;</span>"<span style="color: blue;">/></span></p> + <p style="margin: 0px;"> + <span style="color: blue;"> <</span><span + style="color: #a31515;">strings</span><span style="color: blue;"> </span> + <span style="color: red;">Values</span><span style="color: blue;">=</span>"<span + style="color: blue;">1,2,3</span>"<span style="color: blue;">/></span></p> + <p style="margin: 0px;"> + <span style="color: blue;"> </</span><span style="color: #a31515;">DefaultInstance</span><span + style="color: blue;">></span></p> +</div> +<!--EndFragment--> +<h3>Dictionaries and NameValueCollection</h3> +<p>Any form of IDictionary<Key, Value> or a NameValueCollection can be configured in + Xml by the following syntax. Say you have a class that needs a Dictionary + of properties:</p> +<!-- +{\rtf1\ansi\ansicpg\lang1024\noproof65001\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 ClassWithDictionary\par ??\cf0 \{\par ?? \cf3 private\cf0 \cf3 readonly\cf0 \cf4 IDictionary\cf0 <\cf3 string\cf0 , \cf3 string\cf0 > _dictionary;\par ??\par ?? \cf3 public\cf0 ClassWithDictionary(\cf4 IDictionary\cf0 <\cf3 string\cf0 , \cf3 string\cf0 > dictionary)\par ?? \{\par ?? _dictionary = dictionary;\par ?? \}\par ??\par ?? \cf3 public\cf0 \cf4 IDictionary\cf0 <\cf3 string\cf0 , \cf3 string\cf0 > Dictionary\par ?? \{\par ?? \cf3 get\cf0 \{ \cf3 return\cf0 _dictionary; \}\par ?? \}\par ?? \}} +--> +<div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"> + <p style="margin: 0px;"> + <span style="color: blue;">public</span> <span style="color: blue;"> + class</span> <span style="color: #2b91af;">ClassWithDictionary</span></p> + <p style="margin: 0px;"> + {</p> + <p style="margin: 0px;"> + <span style="color: blue;">private</span> + <span style="color: blue;">readonly</span> <span style="color: #2b91af;"> + IDictionary</span><<span style="color: blue;">string</span>, + <span style="color: blue;">string</span>> _dictionary;</p> + <p style="margin: 0px;"> + </p> + <p style="margin: 0px;"> + <span style="color: blue;">public</span> + ClassWithDictionary(<span style="color: #2b91af;">IDictionary</span><<span + style="color: blue;">string</span>, <span style="color: blue;">string</span>> + dictionary)</p> + <p style="margin: 0px;"> + {</p> + <p style="margin: 0px;"> + _dictionary = + dictionary;</p> + <p style="margin: 0px;"> + }</p> + <p style="margin: 0px;"> + </p> + <p style="margin: 0px;"> + <span style="color: blue;">public</span> + <span style="color: #2b91af;">IDictionary</span><<span style="color: blue;">string</span>, + <span style="color: blue;">string</span>> Dictionary</p> + <p style="margin: 0px;"> + {</p> + <p style="margin: 0px;"> + + <span style="color: blue;">get</span> { <span style="color: blue;">return</span> + _dictionary; }</p> + <p style="margin: 0px;"> + }</p> + <p style="margin: 0px;"> + }</p> +</div> +<!--EndFragment--> +<p>The "dictionary" argument to the constructor function could be defined as:</p> +<!-- +{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red163\green21\blue21;\red255\green0\blue0;\red0\green0\blue0;}??\fs20 \cf1 <\cf3 DefaultInstance\par ??\cf1 \cf4 PluginType\cf1 =\cf0 "\cf1 StructureMap.Testing.Configuration.ClassWithDictionary, StructureMap.Testing\cf0 "\par ??\cf1 \cf4 PluggedType\cf1 =\cf0 "\cf1 StructureMap.Testing.Configuration.ClassWithDictionary, StructureMap.Testing\cf0 "\cf1 >\par ?? <\cf3 Property\cf1 \cf4 Name\cf1 =\cf0 '\cf1 dictionary\cf0 '\cf1 >\par ?? <\cf3 Pair\cf1 \cf4 Key\cf1 =\cf0 '\cf1 color\cf0 '\cf1 \cf4 Value\cf1 =\cf0 '\cf1 red\cf0 '\cf1 />\par ?? <\cf3 Pair\cf1 \cf4 Key\cf1 =\cf0 '\cf1 state\cf0 '\cf1 \cf4 Value\cf1 =\cf0 '\cf1 texas\cf0 '\cf1 />\par ?? <\cf3 Pair\cf1 \cf4 Key\cf1 =\cf0 '\cf1 direction\cf0 '\cf1 \cf4 Value\cf1 =\cf0 '\cf1 north\cf0 '\cf1 />\par ?? </\cf3 Property\cf1 >\par ?? </\cf3 DefaultInstance\cf1 >} +--> +<div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"> +<!-- +{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red163\green21\blue21;\red255\green0\blue0;\red0\green0\blue0;}??\fs20 \cf1 <\cf3 DefaultInstance\par ??\cf1 \cf4 PluginType\cf1 =\cf0 "\cf1 StructureMap.Testing.Configuration.ClassWithDictionary, StructureMap.Testing\cf0 "\par ??\cf1 \cf4 PluggedType\cf1 =\cf0 "\cf1 StructureMap.Testing.Configuration.ClassWithDictionary, StructureMap.Testing\cf0 "\cf1 >\par ?? <\cf3 dictionary\cf1 >\par ?? <\cf3 Pair\cf1 \cf4 Key\cf1 =\cf0 '\cf1 color\cf0 '\cf1 \cf4 Value\cf1 =\cf0 '\cf1 red\cf0 '\cf1 />\par ?? <\cf3 Pair\cf1 \cf4 Key\cf1 =\cf0 '\cf1 state\cf0 '\cf1 \cf4 Value\cf1 =\cf0 '\cf1 texas\cf0 '\cf1 />\par ?? <\cf3 Pair\cf1 \cf4 Key\cf1 =\cf0 '\cf1 direction\cf0 '\cf1 \cf4 Value\cf1 =\cf0 '\cf1 north\cf0 '\cf1 />\par ?? </\cf3 dictionary\cf1 >\par ?? </\cf3 DefaultInstance\cf1 >} +--> + <div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"> + <p style="margin: 0px;"> + <span style="color: blue;"> <</span><span style="color: #a31515;">DefaultInstance</span></p> + <p style="margin: 0px;"> + <span style="color: blue;"> </span><span style="color: red;"> + PluginType</span><span style="color: blue;">=</span>"<span style="color: blue;">StructureMap.Testing.Configuration.ClassWithDictionary, + StructureMap.Testing</span>"</p> + <p style="margin: 0px;"> + <span style="color: blue;"> </span><span style="color: red;"> + PluggedType</span><span style="color: blue;">=</span>"<span + style="color: blue;">StructureMap.Testing.Configuration.ClassWithDictionary, + StructureMap.Testing</span>"<span style="color: blue;">></span></p> + <p style="margin: 0px;"> + <span style="color: blue;"> <</span><span + style="color: #a31515;">dictionary</span><span style="color: blue;">></span></p> + <p style="margin: 0px;"> + <span style="color: blue;"> <</span><span + style="color: #a31515;">Pair</span><span style="color: blue;"> </span> + <span style="color: red;">Key</span><span style="color: blue;">="color" </span> + <span style="color: red;">Value</span><span style="color: blue;">="red"/></span></p> + <p style="margin: 0px;"> + <span style="color: blue;"> <</span><span + style="color: #a31515;">Pair</span><span style="color: blue;"> </span> + <span style="color: red;">Key</span><span style="color: blue;">="state" </span> + <span style="color: red;">Value</span><span style="color: blue;">="texas"/></span></p> + <p style="margin: 0px;"> + <span style="color: blue;"> <</span><span + style="color: #a31515;">Pair</span><span style="color: blue;"> </span> + <span style="color: red;">Key</span><span style="color: blue;">="direction" </span> + <span style="color: red;">Value</span><span style="color: blue;">="north"/></span></p> + <p style="margin: 0px;"> + <span style="color: blue;"> </</span><span + style="color: #a31515;">dictionary</span><span style="color: blue;">></span></p> + <p style="margin: 0px;"> + <span style="color: blue;"> </</span><span style="color: #a31515;">DefaultInstance</span><span + style="color: blue;">></span></p> + </div> +<!--EndFragment--> +<p style="margin: 0px;"> + </p> + + </div> +<!--EndFragment--> +<p>Just create a new node for the IDictionary property called <[propertyName]> under + the main instance node. Then add a <Pair Key="key" Value="value"/> node + for each name/value pair in the IDictionary. </p> +<p> </p> + + </body> +</html> Added: trunk/Source/HTML/AutoMocking.htm =================================================================== --- trunk/Source/HTML/AutoMocking.htm (rev 0) +++ trunk/Source/HTML/AutoMocking.htm 2008-06-23 17:44:01 UTC (rev 125) @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> + <head> + <title></title> + </head> + <body> + + </body> +</html> \ No newline at end of file Added: trunk/Source/HTML/BestPractices.htm =================================================================== --- trunk/Source/HTML/BestPractices.htm (rev 0) +++ trunk/Source/HTML/BestPractices.htm 2008-06-23 17:44:01 UTC (rev 125) @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> + <head> + <title></title> + </head> + <body> + + </body> +</html> \ No newline at end of file Added: trunk/Source/HTML/ChangingDefaultsAtRuntime.htm =================================================================== --- trunk/Source/HTML/ChangingDefaultsAtRuntime.htm (rev 0) +++ trunk/Source/HTML/ChangingDefaultsAtRuntime.htm 2008-06-23 17:44:01 UTC (rev 125) @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> + <head> + <title></title> + </head> + <body> + + </body> +</html> \ No newline at end of file Added: trunk/Source/HTML/CompositeConfiguration.htm =================================================================== --- trunk/Source/HTML/CompositeConfiguration.htm (rev 0) +++ trunk/Source/HTML/CompositeConfiguration.htm 2008-06-23 17:44:01 UTC (rev 125) @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> + <head> + <title></title> + </head> + <body> + + </body> +</html> \ No newline at end of file Added: trunk/Source/HTML/Concepts.htm =================================================================== --- trunk/Source/HTML/Concepts.htm (rev 0) +++ trunk/Source/HTML/Concepts.htm 2008-06-23 17:44:01 UTC (rev 125) @@ -0,0 +1,49 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> + <head> + <title></title> + </head> + <body> + <h3>Patterns and Concepts</h3> + <p> + Object oriented systems are composed of a myriad array of objects communicating + by sending messages to exposed interfaces. To a large degree, the qualities of + an OO design are determined by the structure, organization, and responsibility + assignments of the objects in a system. The qualities of a system most + affected by structure are flexibility, extensibility, maintainability, and + testability. Applications usually meet their demise when the system is + determined to be too difficult or costly to change. The symptoms of a dying + application are a loss of clearly defined structure, an unclear division + of responsibilities in the code, and difficulty testing and troubleshooting the + application. </p> + <p> + Over the years a series of rules and principles have been discovered and + developed to describe well-structured systems. Possibly most important is + <em>Separation of Concerns</em> – pulling separate aspects of the system like + persistence, security, or business logic into separate classes and packages. + Another key concept is the combination of highly cohesive classes in a loosely + coupled structure. The more highly coupled two components of a system are, the + more difficult the system is to maintain, test, and reuse. A class should have a + cohesive set of responsibilities in a narrow domain. In other words, + simpleton classes that do only one thing are much easier to code and test than + <em>God</em> classes that take on far too many unrelated responsibilities. </p> + <p> </p> + <h4>Separation of Concerns</h4> + <h4>Services and Dependencies</h4> + <h4>Dependency Injection</h4> + <h4>Container</h4> + <h4>Service Locator</h4> + <h3>StructureMap Terms</h3> + <h4>PluginType</h4> + <p>Object Oriented Design</p> + <h4>Auto Wiring</h4> + <p>Every "real" IoC container supports the concept of "Auto Wiring." Auto + Wiring simply means that StructureMap can figure out dependency chains for you.</p> + <h4>Instance</h4> + <h4>Scoping</h4> + <h4>PluginFamily</h4> + <h4>Profile</h4> + <h4>Interceptor</h4> + <h4>PostProcessor</h4> + </body> +</html> \ No newline at end of file Added: trunk/Source/HTML/ConcreteTypes.htm =================================================================== --- trunk/Source/HTML/ConcreteTypes.htm (rev 0) +++ trunk/Source/HTML/ConcreteTypes.htm 2008-06-23 17:44:01 UTC (rev 125) @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> + <head> + <title></title> + </head> + <body> + + </body> +</html> \ No newline at end of file Added: trunk/Source/HTML/ConfigurationArchitecture.htm =================================================================== --- trunk/Source/HTML/ConfigurationArchitecture.htm (rev 0) +++ trunk/Source/HTML/ConfigurationArchitecture.htm 2008-06-23 17:44:01 UTC (rev 125) @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> + <head> + <title></title> + </head> + <body> + + </body> +</html> \ No newline at end of file Added: trunk/Source/HTML/ConfiguringStructureMap.htm =================================================================== --- trunk/Source/HTML/ConfiguringStructureMap.htm (rev 0) +++ trunk/Source/HTML/ConfiguringStructureMap.htm 2008-06-23 17:44:01 UTC (rev 125) @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> + <head> + <title></title> + </head> + <body> + + </body> +</html> \ No newline at end of file Added: trunk/Source/HTML/ConstructorAndSetterInjection.htm =================================================================== --- trunk/Source/HTML/ConstructorAndSetterInjection.htm (rev 0) +++ trunk/Source/HTML/ConstructorAndSetterInjection.htm 2008-06-23 17:44:01 UTC (rev 125) @@ -0,0 +1,391 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> + <head> + <title>Constructor and Setter Injection</title> + </head> + <body> + <h1>Constructor and Setter Injection</h1> + + <p>StructureMap supports two forms of Dependency Injection:</p> + + <ol> + <li>Constructor Injection -- "Pushing" dependencies into a concrete class through + constructor arguments.</li> + <li>Setter Injection -- "Pushing" depencencies into a concrete class through public + properties. The "Setter" nomenclature is taken from Java where properties + are getSomething() and setSomething(value).</li> + </ol> + + <p>You can certainly mix and match Setter Injection with Constructor Injection on + the same classes, but Constructor Injection will always be used (except for + empty constructors) and Setter Injection has to be explicitly configured. + See + <a href="http://martinfowler.com/articles/injection.html#ConstructorVersusSetterInjection"> + Martin Fowler's discussion on Constructor versus Setter Injection</a> for more + information. My feeling has always been that Constructor Injection is + preferrable from a design perspective. When you exclusively use + Constructor Injection, the code is somewhat self-documenting because the + constructor arguments will clearly delineate the dependencies of a concrete + class. It's also important to think about the constructor method of a + class being a contract. If you satisfy all of the arguments of the + constructor method, the class should be ready to function. Relying on + Setter Injection can make a class harder to use because it isn't always obvious + which setters need to be created externally to use the class. Of course, + not using any form of Dependency Injection can be the worst answer because then + you have no idea what it really takes to bootstrap the service. </p> + <h2>Using Constructor Injection</h2> + <p>Now, the first question you might ask is how does StructureMap know which + constructor function to use in a class that has multiple constructors? The + answer is that StructureMap will automatically select the "greediest" public + constructor of a class to use for injection. In this case, the "greediest" + constructor is the constructor with the most arguments. In the case of a + tie, StructureMap will use the first constructor that it encountered. For + example, in the code below, the second constructor that takes in two arguments + would be used because it is "greedier."</p> +<!-- +{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red0\green0\blue255;}??\fs20 \cf3 public\cf0 GreaterThanRule()\par ?? \{\par ?? \}\par ??\par ?? \cf3 public\cf0 GreaterThanRule(\cf3 string\cf0 Attribute, \cf3 int\cf0 Value)\par ?? \{\par ?? _Attribute = Attribute;\par ?? _Value = Value;\par ?? \}} +--> + <div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"> + <p style="margin: 0px;"> + <span style="color: blue;">public</span> + GreaterThanRule()</p> + <p style="margin: 0px;"> + {</p> + <p style="margin: 0px;"> + }</p> + <p style="margin: 0px;"> + </p> + <p style="margin: 0px;"> + <span style="color: blue;">public</span> + GreaterThanRule(<span style="color: blue;">string</span> Attribute, + <span style="color: blue;">int</span> Value)</p> + <p style="margin: 0px;"> + {</p> + <p style="margin: 0px;"> + _Attribute = Attribute;</p> + <p style="margin: 0px;"> + _Value = Value;</p> + <p style="margin: 0px;"> + }</p> + </div> +<!--EndFragment--> +<p> </p> + <p>You can always override this behavior by decorating the constructor you want + StructureMap to use with the [StructureMap.DefaultConstructor] attribute like + this sample:</p> +<!-- +{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red43\green145\blue175;\red0\green0\blue255;}??\fs20 [\cf3 DefaultConstructor\cf0 ]\par ?? \cf4 public\cf0 DataSession(\cf3 IDatabaseEngine\cf0 database)\par ?? : \cf4 this\cf0 (database,\par ?? \cf4 new\cf0 \cf3 CommandFactory\cf0 (database),\par ?? \cf4 new\cf0 \cf3 AutoCommitExecutionState\cf0 (database.GetConnection(), database.GetDataAdapter()),\par ?? \cf4 new\cf0 \cf3 TransactionalExecutionState\cf0 (database.GetConnection(), database.GetDataAdapter()))\par ?? \{\par ?? \}} +--> + <div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"> + <p style="margin: 0px;"> + [<span style="color: #2b91af;">DefaultConstructor</span>]</p> + <p style="margin: 0px;"> + <span style="color: blue;">public</span> + DataSession(<span style="color: #2b91af;">IDatabaseEngine</span> database)</p> + <p style="margin: 0px;"> + : + <span style="color: blue;">this</span>(database,</p> + <p style="margin: 0px;"> + + <span style="color: blue;">new</span> <span style="color: #2b91af;"> + CommandFactory</span>(database),</p> + <p style="margin: 0px;"> + + <span style="color: blue;">new</span> <span style="color: #2b91af;"> + AutoCommitExecutionState</span>(database.GetConnection(), + dat... [truncated message content] |
From: <jer...@us...> - 2008-01-12 03:21:34
|
Revision: 52 http://structuremap.svn.sourceforge.net/structuremap/?rev=52&view=rev Author: jeremydmiller Date: 2008-01-11 19:21:32 -0800 (Fri, 11 Jan 2008) Log Message: ----------- the automocking start Modified Paths: -------------- trunk/Source/CommonAssemblyInfo.cs trunk/Source/StructureMap/InstanceFactory.cs trunk/Source/StructureMap.AutoMocking/StructureMap.AutoMocking.csproj trunk/cruise.build Added Paths: ----------- trunk/Source/StructureMap.AutoMocking/IntegrationSpecification.cs Modified: trunk/Source/CommonAssemblyInfo.cs =================================================================== --- trunk/Source/CommonAssemblyInfo.cs 2007-12-30 16:31:10 UTC (rev 51) +++ trunk/Source/CommonAssemblyInfo.cs 2008-01-12 03:21:32 UTC (rev 52) @@ -13,10 +13,10 @@ //------------------------------------------------------------------------------ [assembly: ComVisibleAttribute(false)] -[assembly: AssemblyVersionAttribute("1.0.0.0000")] +[assembly: AssemblyVersionAttribute("2.5.0.0000")] [assembly: AssemblyCopyrightAttribute("Copyright (c) 2007, Jeremy D. Miller")] [assembly: AssemblyProductAttribute("StructureMap")] [assembly: AssemblyCompanyAttribute("")] [assembly: AssemblyConfigurationAttribute("release")] -[assembly: AssemblyInformationalVersionAttribute("1.0.0.0000")] +[assembly: AssemblyInformationalVersionAttribute("2.5.0.0000")] Modified: trunk/Source/StructureMap/InstanceFactory.cs =================================================================== --- trunk/Source/StructureMap/InstanceFactory.cs 2007-12-30 16:31:10 UTC (rev 51) +++ trunk/Source/StructureMap/InstanceFactory.cs 2008-01-12 03:21:32 UTC (rev 52) @@ -15,10 +15,10 @@ /// </summary> public class InstanceFactory : IInstanceFactory, IInstanceCreator { - private Type _pluginType; - private Dictionary<string, InstanceBuilder> _instanceBuilders; + private readonly Type _pluginType; + private readonly Dictionary<string, InstanceBuilder> _instanceBuilders; private MementoSource _source; - private InstanceInterceptor _interceptor = new NulloInterceptor(); + private readonly InstanceInterceptor _interceptor = new NulloInterceptor(); #region static constructors Added: trunk/Source/StructureMap.AutoMocking/IntegrationSpecification.cs =================================================================== --- trunk/Source/StructureMap.AutoMocking/IntegrationSpecification.cs (rev 0) +++ trunk/Source/StructureMap.AutoMocking/IntegrationSpecification.cs 2008-01-12 03:21:32 UTC (rev 52) @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureMap.AutoMocking +{ + public class IntegrationSpecification<TARGETCLASS> + { + } +} Modified: trunk/Source/StructureMap.AutoMocking/StructureMap.AutoMocking.csproj =================================================================== --- trunk/Source/StructureMap.AutoMocking/StructureMap.AutoMocking.csproj 2007-12-30 16:31:10 UTC (rev 51) +++ trunk/Source/StructureMap.AutoMocking/StructureMap.AutoMocking.csproj 2008-01-12 03:21:32 UTC (rev 52) @@ -41,6 +41,7 @@ <Link>CommonAssemblyInfo.cs</Link> </Compile> <Compile Include="AutoMockedInstanceManager.cs" /> + <Compile Include="IntegrationSpecification.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="RhinoAutoMocker.cs" /> <Compile Include="RhinoMocksServiceLocator.cs" /> Modified: trunk/cruise.build =================================================================== --- trunk/cruise.build 2007-12-30 16:31:10 UTC (rev 51) +++ trunk/cruise.build 2008-01-12 03:21:32 UTC (rev 52) @@ -3,7 +3,7 @@ <property name="deployment.dir" value="source\StructureMap.Testing.DeploymentTasks\"/> <property name="results.dir" value="results" /> <property name="nant.dir" value="bin\nant" /> - <property name="project.version" value="1.0.0" /> + <property name="project.version" value="2.5.0" /> <property name="project.config" value="release" /> <property name="archive.dir" value="d:\builds\StructureMap"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2008-01-23 15:39:49
|
Revision: 60 http://structuremap.svn.sourceforge.net/structuremap/?rev=60&view=rev Author: jeremydmiller Date: 2008-01-23 07:39:45 -0800 (Wed, 23 Jan 2008) Log Message: ----------- building things by default without configuration Modified Paths: -------------- trunk/README.TXT trunk/Source/StructureMap/Configuration/ConfigurationParserCollection.cs trunk/Source/StructureMap/InstanceManager.cs trunk/Source/StructureMap/Source/XmlTemplater.cs trunk/Source/StructureMap/StructureMapConfiguration.cs trunk/Source/StructureMap.Testing/AlternativeConfigurationTester.cs trunk/Source/StructureMap.Testing/Configuration/ConfigurationParserCollectionTester.cs trunk/Source/StructureMap.Testing/Container/InstanceManagerTester.cs trunk/Source/StructureMap.Testing/TestData/DataMother.cs Modified: trunk/README.TXT =================================================================== --- trunk/README.TXT 2008-01-17 17:46:06 UTC (rev 59) +++ trunk/README.TXT 2008-01-23 15:39:45 UTC (rev 60) @@ -1,4 +1,4 @@ -To start using StructureMap, either use the DLL's in the build folder or click on the RunBuild.BAT file to run the full NAnt build. There is a known issue with the build "sticking" on the custom NAnt tasks. If this happens, delete the copies of StructureMap.Dll and StructureMap.DeploymentTasks.Dll in the bin\NAnt folder. +To start using StructureMap, either use the DLL's in the build folder or click on the RunBuild.BAT file to run the full NAnt build. There is a known issue with the build "sticking" on the custom NAnt tasks. If this happens, delete the copies of StructureMap.Dll and StructureMap.DeploymentTasks.Dll in the bin\NAnt folder. Look in the "build" directory for the build products. A copy of the StructureMap website and documentation is in the "Docs" folder. Modified: trunk/Source/StructureMap/Configuration/ConfigurationParserCollection.cs =================================================================== --- trunk/Source/StructureMap/Configuration/ConfigurationParserCollection.cs 2008-01-17 17:46:06 UTC (rev 59) +++ trunk/Source/StructureMap/Configuration/ConfigurationParserCollection.cs 2008-01-23 15:39:45 UTC (rev 60) @@ -11,21 +11,31 @@ { private List<FetchNodeDelegate> _fetchers = new List<FetchNodeDelegate>(); private List<string> _otherFiles = new List<string>(); - private bool _useDefaultFile = true; + private bool _UseAndEnforceExistenceOfDefaultFile = false; + private bool _ignoreDefaultFile = false; - public bool UseDefaultFile + public bool UseAndEnforceExistenceOfDefaultFile { - get { return _useDefaultFile; } - set { _useDefaultFile = value; } + get { return _UseAndEnforceExistenceOfDefaultFile; } + set { _UseAndEnforceExistenceOfDefaultFile = value; } } + + public bool IgnoreDefaultFile + { + get { return _ignoreDefaultFile; } + set { _ignoreDefaultFile = value; } + } + public ConfigurationParser[] GetParsers() { List<ConfigurationParser> list = new List<ConfigurationParser>(); - if (_useDefaultFile) + // Pick up the configuration in the default StructureMap.config + string pathToStructureMapConfig = StructureMapConfiguration.GetStructureMapConfigurationPath(); + if ( (_UseAndEnforceExistenceOfDefaultFile || File.Exists(pathToStructureMapConfig)) && !_ignoreDefaultFile) { - addParsersFromFile(StructureMapConfiguration.GetStructureMapConfigurationPath(), list); + addParsersFromFile(pathToStructureMapConfig, list); } foreach (string file in _otherFiles) Modified: trunk/Source/StructureMap/InstanceManager.cs =================================================================== --- trunk/Source/StructureMap/InstanceManager.cs 2008-01-17 17:46:06 UTC (rev 59) +++ trunk/Source/StructureMap/InstanceManager.cs 2008-01-23 15:39:45 UTC (rev 60) @@ -80,17 +80,25 @@ { get { + // Preprocess a GenericType if (pluginType.IsGenericType && !_factories.ContainsKey(pluginType)) { PluginFamily family = _genericsGraph.CreateTemplatedFamily(pluginType); return registerPluginFamily(family); } + // Create a new InstanceFactory for a Concrete type if (!_factories.ContainsKey(pluginType)) { - throw new StructureMapException(208, pluginType.FullName); + if (pluginType.IsInterface || pluginType.IsAbstract) + { + throw new StructureMapException(208, pluginType.FullName); + } + + return getOrCreateFactory(pluginType); } + // Normal usage return _factories[pluginType]; } set { _factories[pluginType] = value; } @@ -390,15 +398,20 @@ throw new StructureMapException(230); } - IInstanceFactory factory = getOrCreateFactory(type, delegate(Type t) - { - PluginFamily family = - PluginFamily.CreateAutoFilledPluginFamily(t); - return new InstanceFactory(family, true); - }); + IInstanceFactory factory = getOrCreateFactory(type); return factory.GetInstance(); } + private IInstanceFactory getOrCreateFactory(Type type) + { + return getOrCreateFactory(type, delegate(Type t) + { + PluginFamily family = + PluginFamily.CreateAutoFilledPluginFamily(t); + return new InstanceFactory(family, true); + }); + } + protected IInstanceFactory getOrCreateFactory(Type type, CreateFactoryDelegate createFactory) { if (!_factories.ContainsKey(type)) Modified: trunk/Source/StructureMap/Source/XmlTemplater.cs =================================================================== --- trunk/Source/StructureMap/Source/XmlTemplater.cs 2008-01-17 17:46:06 UTC (rev 59) +++ trunk/Source/StructureMap/Source/XmlTemplater.cs 2008-01-23 15:39:45 UTC (rev 60) @@ -1,4 +1,4 @@ -using System.Collections; +using System.Collections.Generic; using System.Text; using System.Xml; @@ -6,8 +6,8 @@ { public class XmlTemplater { - private string[] _substitutions; - private string _templateXml; + private readonly string[] _substitutions; + private readonly string _templateXml; public XmlTemplater(XmlNode templateNode) { @@ -62,7 +62,7 @@ private class Collector { private readonly XmlNode _templateNode; - private ArrayList _substitutionList = new ArrayList(); + private readonly List<string> _substitutionList = new List<string>(); public Collector(XmlNode templateNode) { @@ -73,7 +73,7 @@ { searchNode(_templateNode); - return (string[]) _substitutionList.ToArray(typeof (string)); + return _substitutionList.ToArray(); } private void searchNode(XmlNode node) Modified: trunk/Source/StructureMap/StructureMapConfiguration.cs =================================================================== --- trunk/Source/StructureMap/StructureMapConfiguration.cs 2008-01-17 17:46:06 UTC (rev 59) +++ trunk/Source/StructureMap/StructureMapConfiguration.cs 2008-01-23 15:39:45 UTC (rev 60) @@ -30,10 +30,17 @@ /// </summary> public static bool UseDefaultStructureMapConfigFile { - get { return _collection.UseDefaultFile; } - set { _collection.UseDefaultFile = value; } + get { return _collection.UseAndEnforceExistenceOfDefaultFile; } + set { _collection.UseAndEnforceExistenceOfDefaultFile = value; } } + + public static bool IgnoreStructureMapConfig + { + get { return _collection.IgnoreDefaultFile; } + set { _collection.IgnoreDefaultFile = value; } + } + public static bool PullConfigurationFromAppConfig { get { return _pullConfigurationFromAppConfig; } @@ -76,6 +83,8 @@ _registries.Add(_registry); _startUp = null; _pullConfigurationFromAppConfig = false; + UseDefaultStructureMapConfigFile = false; + IgnoreStructureMapConfig = false; } /// <summary> Modified: trunk/Source/StructureMap.Testing/AlternativeConfigurationTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/AlternativeConfigurationTester.cs 2008-01-17 17:46:06 UTC (rev 59) +++ trunk/Source/StructureMap.Testing/AlternativeConfigurationTester.cs 2008-01-23 15:39:45 UTC (rev 60) @@ -14,6 +14,8 @@ [SetUp] public void SetUp() { + DataMother.BackupStructureMapConfig(); + ObjectFactory.ReInitialize(); StructureMapConfiguration.ResetAll(); DataMother.WriteDocument("Config1.xml"); @@ -26,6 +28,9 @@ { StructureMapConfiguration.ResetAll(); ObjectFactory.Reset(); + + + DataMother.RestoreStructureMapConfig(); } #endregion @@ -65,11 +70,19 @@ [Test] public void NotTheDefault() { - StructureMapConfiguration.UseDefaultStructureMapConfigFile = false; - StructureMapConfiguration.IncludeConfigurationFromFile("Config1.xml"); - ObjectFactory.Reset(); + try + { + StructureMapConfiguration.UseDefaultStructureMapConfigFile = false; + StructureMapConfiguration.IgnoreStructureMapConfig = true; + StructureMapConfiguration.IncludeConfigurationFromFile("Config1.xml"); + ObjectFactory.Reset(); - assertTheDefault("Orange"); + assertTheDefault("Orange"); + } + finally + { + DataMother.RestoreStructureMapConfig(); + } } [Test] Modified: trunk/Source/StructureMap.Testing/Configuration/ConfigurationParserCollectionTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/ConfigurationParserCollectionTester.cs 2008-01-17 17:46:06 UTC (rev 59) +++ trunk/Source/StructureMap.Testing/Configuration/ConfigurationParserCollectionTester.cs 2008-01-23 15:39:45 UTC (rev 60) @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Xml; using NUnit.Framework; using StructureMap.Configuration; @@ -15,8 +16,15 @@ public void SetUp() { _collection = new ConfigurationParserCollection(); + DataMother.BackupStructureMapConfig(); } + [TearDown] + public void TearDown() + { + DataMother.RestoreStructureMapConfig(); + } + #endregion private ConfigurationParserCollection _collection; @@ -38,7 +46,11 @@ [Test] public void DoNotUseDefaultAndUseADifferentFile() { - _collection.UseDefaultFile = false; + DataMother.RemoveStructureMapConfig(); + + _collection.UseAndEnforceExistenceOfDefaultFile = false; + _collection.IgnoreDefaultFile = true; + DataMother.WriteDocument("GenericsTesting.xml"); _collection.IncludeFile("GenericsTesting.xml"); @@ -51,7 +63,8 @@ )] public void FileDoesNotExist() { - _collection.UseDefaultFile = false; + _collection.UseAndEnforceExistenceOfDefaultFile = false; + _collection.IgnoreDefaultFile = true; _collection.IncludeFile("DoesNotExist.xml"); _collection.GetParsers(); } @@ -59,11 +72,14 @@ [Test] public void GetIncludes() { + DataMother.RemoveStructureMapConfig(); + DataMother.WriteDocument("Include1.xml"); DataMother.WriteDocument("Include2.xml"); DataMother.WriteDocument("Master.xml"); - _collection.UseDefaultFile = false; + _collection.UseAndEnforceExistenceOfDefaultFile = false; + _collection.IgnoreDefaultFile = true; _collection.IncludeFile("Master.xml"); assertParserIdList("Include1", "Include2", "Master"); @@ -79,7 +95,7 @@ DataMother.WriteDocument("GenericsTesting.xml"); _collection.IncludeFile("GenericsTesting.xml"); - _collection.UseDefaultFile = true; + _collection.UseAndEnforceExistenceOfDefaultFile = true; _collection.IncludeFile("Master.xml"); assertParserIdList("Generics", "Include1", "Include2", "Main", "Master"); @@ -88,6 +104,8 @@ [Test] public void GetXmlFromSomewhereElse() { + DataMother.RemoveStructureMapConfig(); + string xml = "<StructureMap Id=\"Somewhere\"/>"; XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); @@ -95,7 +113,8 @@ FetchNodeDelegate fetcher = delegate { return doc.DocumentElement; }; _collection.IncludeNode(fetcher); - _collection.UseDefaultFile = false; + _collection.UseAndEnforceExistenceOfDefaultFile = false; + _collection.IgnoreDefaultFile = true; assertParserIdList("Somewhere"); } @@ -103,14 +122,14 @@ [Test] public void SimpleDefaultConfigurationParser() { - _collection.UseDefaultFile = true; + _collection.UseAndEnforceExistenceOfDefaultFile = true; assertParserIdList("Main"); } [Test] public void UseDefaultIsTrueUponConstruction() { - Assert.IsTrue(_collection.UseDefaultFile); + Assert.IsFalse(_collection.UseAndEnforceExistenceOfDefaultFile); } } } \ No newline at end of file Modified: trunk/Source/StructureMap.Testing/Container/InstanceManagerTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/InstanceManagerTester.cs 2008-01-17 17:46:06 UTC (rev 59) +++ trunk/Source/StructureMap.Testing/Container/InstanceManagerTester.cs 2008-01-23 15:39:45 UTC (rev 60) @@ -1,5 +1,6 @@ using System; using NUnit.Framework; +using StructureMap.Configuration.DSL; using StructureMap.Configuration.Mementos; using StructureMap.Graph; using StructureMap.Interceptors; @@ -145,5 +146,56 @@ InstanceManager manager = new InstanceManager(pluginGraph); Assert.AreSame(pluginGraph.DefaultManager, manager.DefaultManager); } + + [Test] + public void CanBuildConcreteTypesThatAreNotPreviouslyRegistered() + { + // Create a new InstanceManager that has a default instance configured for only the + // IProvider interface. InstanceManager is the real "container" behind ObjectFactory + Registry registry = new Registry(); + registry.ForRequestedType<IProvider>().TheDefaultIsConcreteType<Provider>(); + InstanceManager manager = (InstanceManager) registry.BuildInstanceManager(); + + // Now, have that same InstanceManager create a ClassThatUsesProvider. StructureMap will + // see that ClassThatUsesProvider is concrete, determine its constructor args, and build one + // for you with the default IProvider. No other configuration necessary. + ClassThatUsesProvider classThatUsesProvider = manager.CreateInstance<ClassThatUsesProvider>(); + Assert.IsInstanceOfType(typeof(Provider), classThatUsesProvider.Provider); + } + + [Test] + public void CanBuildConcreteTypesThatAreNotPreviouslyRegisteredWithArgumentsProvided() + { + Registry registry = new Registry(); + registry.ForRequestedType<IProvider>().TheDefaultIsConcreteType<Provider>(); + InstanceManager manager = (InstanceManager)registry.BuildInstanceManager(); + + DifferentProvider differentProvider = new DifferentProvider(); + ExplicitArguments args = new ExplicitArguments(); + args.Set<IProvider>(differentProvider); + + ClassThatUsesProvider classThatUsesProvider = manager.CreateInstance<ClassThatUsesProvider>(args); + Assert.AreSame(differentProvider, classThatUsesProvider.Provider); + } + + public interface IProvider{} + public class Provider : IProvider {} + public class ClassThatUsesProvider + { + private readonly IProvider _provider; + + public ClassThatUsesProvider(IProvider provider) + { + _provider = provider; + } + + + public IProvider Provider + { + get { return _provider; } + } + } + + public class DifferentProvider : IProvider{} } } \ No newline at end of file Modified: trunk/Source/StructureMap.Testing/TestData/DataMother.cs =================================================================== --- trunk/Source/StructureMap.Testing/TestData/DataMother.cs 2008-01-17 17:46:06 UTC (rev 59) +++ trunk/Source/StructureMap.Testing/TestData/DataMother.cs 2008-01-23 15:39:45 UTC (rev 60) @@ -17,6 +17,26 @@ { } + public static void BackupStructureMapConfig() + { + if (File.Exists("StructureMap.config.bak")) File.Delete("StructureMap.config.bak"); + File.Copy("StructureMap.config", "StructureMap.config.bak"); + } + + public static void RestoreStructureMapConfig() + { + if (!File.Exists("StructureMap.config")) + { + File.Copy("StructureMap.config.bak", "StructureMap.config"); + } + + } + + public static void RemoveStructureMapConfig() + { + if (File.Exists("StructureMap.config")) File.Delete("StructureMap.config"); + } + public static XmlDocument GetXmlDocument(string fileName) { XmlDocument document = new XmlDocument(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2008-04-06 16:08:31
|
Revision: 69 http://structuremap.svn.sourceforge.net/structuremap/?rev=69&view=rev Author: jeremydmiller Date: 2008-04-06 09:08:28 -0700 (Sun, 06 Apr 2008) Log Message: ----------- getting rid of crap. Killed off the kloogey explorer/diagnostic stuff Modified Paths: -------------- trunk/Source/StructureMap/Configuration/Mementos/ExplicitArgumentMemento.cs trunk/Source/StructureMap/Configuration/Mementos/ExplicitArguments.cs trunk/Source/StructureMap/Graph/InstanceDefault.cs trunk/Source/StructureMap/Graph/InstanceDefaultManager.cs trunk/Source/StructureMap/Graph/MachineOverride.cs trunk/Source/StructureMap/Graph/Profile.cs trunk/Source/StructureMap/IPluginGraphSource.cs trunk/Source/StructureMap/InstanceFactory.cs trunk/Source/StructureMap/InstanceMemento.cs trunk/Source/StructureMap/MementoSource.cs trunk/Source/StructureMap/PluginGraphBuilder.cs trunk/Source/StructureMap/Source/TemplatedMementoSource.cs trunk/Source/StructureMap/Source/XmlAttributeInstanceMemento.cs trunk/Source/StructureMap/Source/XmlNodeInstanceMemento.cs trunk/Source/StructureMap/StructureMap.csproj trunk/Source/StructureMap/StructureMapConfiguration.cs trunk/Source/StructureMap.AutoMocking/AutoMockedInstanceManager.cs trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs trunk/Source/StructureMap.DeploymentTasks/StructureMap.DeploymentTasks.csproj trunk/Source/StructureMap.Testing/Configuration/ConfigurationParserCollectionTester.cs trunk/Source/StructureMap.Testing/Container/ExplicitArgumentTester.cs trunk/Source/StructureMap.Testing/Container/PluginGraphBuilderTester.cs trunk/Source/StructureMap.Testing/Container/Source/TemplatingTester.cs trunk/Source/StructureMap.Testing/Container/Source/XmlAttributeInstanceMementoTester.cs trunk/Source/StructureMap.Testing/GenericsAcceptanceTester.cs trunk/Source/StructureMap.Testing/ObjectMother.cs trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj trunk/Source/StructureMap.Testing/StructureMapConfigurationTester.cs trunk/Source/StructureMap.sln trunk/cruise.build Removed Paths: ------------- trunk/AbstracnessVSInstability.png trunk/ApplicationMetrics.xml trunk/AssembliesBuildOrder.xml trunk/AssembliesDependencies.xml trunk/AssembliesMetrics.xml trunk/ComponentDependenciesDiagram.png trunk/Deploy.build trunk/InfoWarnings.xml trunk/NDependInput.xml trunk/NDependMain.xml trunk/NDependReport.html trunk/RunBuild.BAT trunk/RunMetrics.bat trunk/RunVerficationTesting.BAT trunk/Source/Client/ trunk/Source/StructureMap.Client/ trunk/Source/StructureMap.Testing.DeploymentTasks/ trunk/Source/StructureMap.Testing.PluginGraph/ trunk/Source/StructureMapExplorer/ trunk/StructureMap.build trunk/TypesDependencies.xml trunk/TypesMetrics.xml trunk/verificationTesting.build Deleted: trunk/AbstracnessVSInstability.png =================================================================== (Binary files differ) Deleted: trunk/ApplicationMetrics.xml =================================================================== --- trunk/ApplicationMetrics.xml 2008-02-28 15:00:17 UTC (rev 68) +++ trunk/ApplicationMetrics.xml 2008-04-06 16:08:28 UTC (rev 69) @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<ApplicationMetrics NAsm="3" NType="191" NClass="164" NAbstractClass="33" NInterface="19" NValueType="8" NExceptionType="3" NAttributeType="5" NDelegateType="2" NEnumType="8" NILInstruction="23437" PercentPublicType="98.95" PercentPublicMethod="71.69" PercentClassWithAtLeastOnePublicField="4.27"> - <PropertyOnInterface Occ="19" Avg="0.95" StdDev="1.5" MaxVal="5" MaxName="Asm:StructureMap Interface:StructureMap.Caching.ICacheItem" /> - <MethodOnInterface Occ="19" Avg="4.32" StdDev="4.66" MaxVal="18" MaxName="Asm:StructureMap Interface:StructureMap.Configuration.IConfigurationVisitor" /> - <ArgOnMethodOnInterface Occ="82" Avg="0.95" StdDev="0.82" MaxVal="4" MaxName="Asm:StructureMap Interface:StructureMap.Graph.Configuration.IGraphBuilder Method:AddPluginFamily" /> - <PublicPropertyOnClass Occ="164" Avg="4.71" StdDev="9.32" MaxVal="109" MaxName="Asm:StructureMap.Client Class:StructureMap.Client.Shell.ApplicationShell" /> - <PublicMethodOnClass Occ="164" Avg="17.28" StdDev="31.69" MaxVal="403" MaxName="Asm:StructureMap.Client Class:StructureMap.Client.Shell.ApplicationShell" /> - <ArgOnPublicMethodOnClass Occ="2834" Avg="0.55" StdDev="0.65" MaxVal="5" MaxName="Asm:StructureMap.Client Class:StructureMap.Client.Shell.ApplicationShell Method:SelectNextControl" /> - <ILInstructionInNonAbstractMethods Occ="1905" Avg="12.31" StdDev="18.76" MaxVal="559" MaxName="Asm:StructureMap.Client Class:StructureMap.Client.Shell.ApplicationShell Method:InitializeComponent()" /> - <TypeWithTheMostILInstruction Occ="162" Avg="144.79" StdDev="123.59" MaxVal="836" MaxName="Asm:StructureMap.Client Type:StructureMap.Client.Shell.ApplicationShell" /> - <MethodCC Occ="1905" Avg="0.53" StdDev="1.32" MaxVal="12" MaxName="Asm:StructureMap Type:StructureMap.Graph.PluginGraph Method:Seal()" /> - <ResponseForType Occ="191" Avg="640.42" StdDev="1054.65" MaxVal="6562" MaxName="Asm:StructureMap Type:StructureMap.Configuration.DiagnosticGraphBuilder" /> -</ApplicationMetrics> \ No newline at end of file Deleted: trunk/AssembliesBuildOrder.xml =================================================================== --- trunk/AssembliesBuildOrder.xml 2008-02-28 15:00:17 UTC (rev 68) +++ trunk/AssembliesBuildOrder.xml 2008-04-06 16:08:28 UTC (rev 69) @@ -1,2 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<AssemblySortForCompilOrObfusk /> \ No newline at end of file Deleted: trunk/AssembliesDependencies.xml =================================================================== --- trunk/AssembliesDependencies.xml 2008-02-28 15:00:17 UTC (rev 68) +++ trunk/AssembliesDependencies.xml 2008-04-06 16:08:28 UTC (rev 69) @@ -1,2 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<AssemblyDependencies /> \ No newline at end of file Deleted: trunk/AssembliesMetrics.xml =================================================================== --- trunk/AssembliesMetrics.xml 2008-02-28 15:00:17 UTC (rev 68) +++ trunk/AssembliesMetrics.xml 2008-04-06 16:08:28 UTC (rev 69) @@ -1,2 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<AssembliesMetrics /> \ No newline at end of file Deleted: trunk/ComponentDependenciesDiagram.png =================================================================== (Binary files differ) Deleted: trunk/Deploy.build =================================================================== --- trunk/Deploy.build 2008-02-28 15:00:17 UTC (rev 68) +++ trunk/Deploy.build 2008-04-06 16:08:28 UTC (rev 69) @@ -1,31 +0,0 @@ -<project name="Deploy-StructureMap" default="all"> - <property name="nant.bin.dir" value="D:\work\Dependencies-trunk\external\nant" /> - <property name="structuremap.bin.dir" value="D:\work\Dependencies-trunk\external\StructureMap" /> - - <property name="build.dir" value="build" /> - - - <target name="all" depends="copy, checkin"/> - - <target name="copy"> - <copy file="${build.dir}\StructureMap.dll" todir="${nant.bin.dir}"/> - <copy file="${build.dir}\StructureMap.DeploymentTasks.dll" todir="${nant.bin.dir}"/> - - <copy file="${build.dir}\StructureMap.dll" todir="${structuremap.bin.dir}"/> - <copy file="${build.dir}\StructureMapDoctor.exe" todir="${structuremap.bin.dir}"/> - <copy file="${build.dir}\StructureMapExplorer.exe" todir="${structuremap.bin.dir}"/> - <copy file="${build.dir}\StructureMap.Client.dll" todir="${structuremap.bin.dir}"/> - <copy file="${build.dir}\StructureMap.DeploymentTasks.dll" todir="${structuremap.bin.dir}"/> - <copy file="${build.dir}\AxInterop.SHDocVw.dll" todir="${structuremap.bin.dir}"/> - <copy file="${build.dir}\Interop.SHDocVw.dll" todir="${structuremap.bin.dir}"/> - </target> - - <target name="checkin"> - <ifnot test="${property::exists('CCNetLabel')}"> - <property name="CCNetLabel" value="0001" /> - </ifnot> - - <exec program="svn.exe" workingdir="${nant.bin.dir}" commandline="ci --username CruiseControl.net --password SomethingSneaky -m"automatic check-in, cc.net label ${CCNetLabel}"" /> - <exec program="svn.exe" workingdir="${structuremap.bin.dir}" commandline="ci --username CruiseControl.net --password SomethingSneaky -m"automatic check-in, cc.net label ${CCNetLabel}"" /> - </target> -</project> \ No newline at end of file Deleted: trunk/InfoWarnings.xml =================================================================== --- trunk/InfoWarnings.xml 2008-02-28 15:00:17 UTC (rev 68) +++ trunk/InfoWarnings.xml 2008-04-06 16:08:28 UTC (rev 69) @@ -1,1132 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<InfoWarnings> - <Info>INFO: 5/7/2006 8:54:07 AM Retrieve dependencies of your application.</Info> - <Info>INFO: 5/7/2006 8:54:09 AM Analyse dependencies of your application.</Info> - <Info>INFO: No cycle detected.</Info> - <Warning>WARNING: The assembly with simple name {StructureMap.Diagnostics} was not found in specified directories.</Warning> - <Warning>WARNING: The assembly with simple name {log4net} was not found in specified directories.</Warning> - <Warning>WARNING: The assembly with simple name {nunit.framework} was not found in specified directories.</Warning> - <WarningByType TypeName="StructureMap.Configuration.Tokens.AssemblyToken"> - <Warning>WARNING: In the context of this application, the method {StructureMap.Configuration.Tokens.AssemblyToken.MarkLoadFailure(System.Exception)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Configuration.Tokens.AssemblyToken..ctor(System.String,System.String[])} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Notify"> - <Warning>WARNING: In the context of this application, the type {StructureMap.Notify} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Configuration.Tokens.MementoSourceInstanceToken"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Configuration.Tokens.MementoSourceInstanceToken..ctor(System.String,StructureMap.Configuration.PluginGraphReport,StructureMap.InstanceMemento)} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Emitting.Parameters.ChildArrayParameterEmitter"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Emitting.Parameters.ChildArrayParameterEmitter..ctor()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Emitting.Parameters.ChildArrayParameterEmitter} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Emitting.Parameters.PrimitiveParameterEmitter"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Emitting.Parameters.PrimitiveParameterEmitter..ctor()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Emitting.Parameters.PrimitiveParameterEmitter} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Configuration.Tokens.FamilyToken"> - <Warning>WARNING: In the context of this application, the method {StructureMap.Configuration.Tokens.FamilyToken.ReadInstances(StructureMap.Graph.PluginFamily,StructureMap.Configuration.PluginGraphReport)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Configuration.Tokens.FamilyToken.Validate(StructureMap.Configuration.IInstanceValidator)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Configuration.Tokens.FamilyToken.AddInstance(StructureMap.Configuration.Tokens.InstanceToken)} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Configuration.Tokens.FamilyToken.AddInterceptor(StructureMap.Configuration.Tokens.InstanceToken)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Configuration.Tokens.FamilyToken.FindTemplate(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Configuration.Tokens.FamilyToken.get_Templates()} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Configuration.Tokens.FamilyToken.FindPlugin(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Configuration.Tokens.FamilyToken.AddPlugin(StructureMap.Configuration.Tokens.PluginToken)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Configuration.Tokens.FamilyToken.MarkTypeCannotBeLoaded(System.Exception)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Configuration.Tokens.FamilyToken.set_SourceInstance(StructureMap.Configuration.Tokens.InstanceToken)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Configuration.Tokens.FamilyToken.get_SourceInstance()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Configuration.Tokens.FamilyToken.set_Scope(StructureMap.Attributes.InstanceScope)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Configuration.Tokens.FamilyToken.get_DefaultKey()} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Configuration.Tokens.FamilyToken.set_DefinitionSource(StructureMap.Graph.DefinitionSource)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Configuration.Tokens.FamilyToken.get_DefinitionSource()} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Configuration.Tokens.FamilyToken.get_AssemblyName()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Configuration.Tokens.FamilyToken.CreateImplicitFamily(StructureMap.Graph.PluginFamily)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Configuration.Tokens.FamilyToken..ctor(StructureMap.Graph.TypePath,System.String,System.String[])} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Configuration.Tokens.FamilyToken.HasInstance(System.String)} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Configuration.Tokens.FamilyToken.get_Interceptors()} could have the visibility {private} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Caching.EventDispatcher"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Caching.EventDispatcher..ctor(System.String)} could have the visibility {protected} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Caching.EventDispatcher.Dispatch()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Caching.EventDispatcher.RemoveCache(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Caching.EventDispatcher.AddManagedCache(StructureMap.Caching.IManagedCache)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Caching.EventDispatcher.get_SubjectName()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Caching.EventDispatcher.dispatch(StructureMap.Caching.IManagedCache)} could have the visibility {private} instead of the visibility {protected}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Client.Controllers.HTMLSourceFactory"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Client.Controllers.HTMLSourceFactory..ctor()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Client.Controllers.HTMLSourceFactory} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Graph.DefinitionSource"> - <Warning>WARNING: In the context of this application, the type {StructureMap.Graph.DefinitionSource} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Caching.Expirations.AbsoluteTimeExpirationPolicy"> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Caching.Expirations.AbsoluteTimeExpirationPolicy.get_Ticks()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Caching.Expirations.AbsoluteTimeExpirationPolicy} is never used.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Source.BasicXmlMementoSource"> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Source.BasicXmlMementoSource.set_Family(StructureMap.Graph.PluginFamily)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Source.BasicXmlMementoSource.get_Family()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Source.BasicXmlMementoSource.GetAllMementos()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Source.BasicXmlMementoSource.set_DefaultMemento(StructureMap.InstanceMemento)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Source.BasicXmlMementoSource.get_DefaultMemento()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Source.BasicXmlMementoSource.SetDefault(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Source.BasicXmlMementoSource.AddExternalMemento(StructureMap.InstanceMemento)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Source.BasicXmlMementoSource.GetMemento(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Source.BasicXmlMementoSource.createMemento(System.Xml.XmlNode)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Source.BasicXmlMementoSource.get_KeyAttribute()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Source.BasicXmlMementoSource.get_TypeAttribute()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Source.BasicXmlMementoSource.get_NodeName()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Source.BasicXmlMementoSource} is never used.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.DeploymentTasks.Deployment"> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.Deployment.get_MachineSpecificOption()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.Deployment.set_MachineOption(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.Deployment.set_Profile(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.Deployment.get_Profile()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.Deployment.get_DeploymentTarget()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.Deployment.set_DestinationPath(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.Deployment.set_MachineName(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.Deployment.get_MachineName()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.DeploymentTasks.Deployment.CreateConfiguration()} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.Deployment.set_MachineSpecificOption(StructureMap.DeploymentTasks.MachineSpecificOption)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.Deployment.get_DestinationPath()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.Deployment.set_ConfigPath(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.Deployment.get_ConfigPath()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.Deployment.get_MachineOption()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.Deployment.set_DeploymentTarget(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.DeploymentTasks.Deployment} is never used.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.DeploymentTasks.RemoveAssemblyTask"> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.RemoveAssemblyTask.set_AssemblyName(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.RemoveAssemblyTask.get_AssemblyName()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.RemoveAssemblyTask.set_ConfigPath(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.RemoveAssemblyTask.get_ConfigPath()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.DeploymentTasks.RemoveAssemblyTask} is never used.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Caching.CacheManager"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Caching.CacheManager..ctor(System.Int32)} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Caching.CacheManager.get_IsPolling()} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Caching.CacheManager.ReleaseCache(System.String)} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Caching.CacheManager.WatchFile(System.String,StructureMap.Caching.IManagedCache)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Caching.CacheManager.ManageCache(StructureMap.Caching.IManagedCache)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Caching.CacheManager.get_CurrentManager()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Caching.CacheManager} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.DeploymentTasks.Verification"> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.Verification.get_BinPath()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.Verification.set_ConfigPath(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.Verification.get_ConfigPath()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.Verification.set_BinPath(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.DeploymentTasks.Verification} is never used.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Source.XmlMementoStyle"> - <Warning>WARNING: In the context of this application, the type {StructureMap.Source.XmlMementoStyle} is never used.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Source.XmlMementoSource"> - <Warning>WARNING: In the context of this application, the method {StructureMap.Source.XmlMementoSource.createMemento(System.Xml.XmlNode)} could have the visibility {private} instead of the visibility {protected}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Source.XmlMementoSource.getRootNode()} could have the visibility {private} instead of the visibility {protected}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Source.XmlMementoSource..ctor(System.String,System.String,System.String,StructureMap.Source.XmlMementoStyle)} could have the visibility {protected} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Configuration.InstanceValidator"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Configuration.InstanceValidator..ctor(StructureMap.Graph.PluginGraph,StructureMap.Graph.Profile,StructureMap.InstanceManager)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Configuration.InstanceValidator} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Verification.PluginGraphConsoleWriter"> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Verification.PluginGraphConsoleWriter.set_WriteProblems(System.Boolean)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Verification.PluginGraphConsoleWriter.get_WriteProblems()} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Verification.PluginGraphConsoleWriter.set_WriteAll(System.Boolean)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Verification.PluginGraphConsoleWriter.get_WriteAll()} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Verification.PluginGraphConsoleWriter.set_IncludeSource(System.Boolean)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Verification.PluginGraphConsoleWriter.get_IncludeSource()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Verification.PluginGraphConsoleWriter.set_IncludeAllInstances(System.Boolean)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Verification.PluginGraphConsoleWriter.get_IncludeAllInstances()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Verification.PluginGraphConsoleWriter.set_IncludePlugins(System.Boolean)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Verification.PluginGraphConsoleWriter.get_IncludePlugins()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Verification.PluginGraphConsoleWriter.GetReport()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Verification.PluginGraphConsoleWriter.Write(System.IO.TextWriter)} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Verification.PluginGraphConsoleWriter} is never used.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Source.MemoryMementoSource"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Source.MemoryMementoSource..ctor()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Source.MemoryMementoSource} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Interceptors.InstanceFactoryInterceptor"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Interceptors.InstanceFactoryInterceptor..ctor()} could have the visibility {protected} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Exceptions.MissingPluginFamilyException"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Exceptions.MissingPluginFamilyException..ctor(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Exceptions.MissingPluginFamilyException} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Graph.Configuration.IGraphBuilder"> - <Warning>WARNING: In the context of this application, the type {StructureMap.Graph.Configuration.IGraphBuilder} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.InstanceFactory"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.InstanceFactory..ctor(StructureMap.Graph.PluginFamily,System.Boolean)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.InstanceFactory} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Caching.SerializationStorageStrategy"> - <Warning>WARNING: In the context of this application, the type {StructureMap.Caching.SerializationStorageStrategy} is never used.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Graph.PluginGraphObjectCollection"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Graph.PluginGraphObjectCollection..ctor(StructureMap.Graph.PluginGraph)} could have the visibility {protected} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.PluginGraphObjectCollection.get_innerCollection()} could have the visibility {private} instead of the visibility {protected}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Caching.SharedCacheItem"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Caching.SharedCacheItem..ctor(System.Object)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Caching.SharedCacheItem} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Emitting.BuildInstanceMethod"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Emitting.BuildInstanceMethod..ctor(StructureMap.Graph.Plugin)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Emitting.BuildInstanceMethod} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.XmlMapping.ConfigEditor"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.XmlMapping.ConfigEditor..ctor(System.Xml.XmlDocument)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.XmlMapping.ConfigEditor.RemoveAllMachineOptions()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.XmlMapping.ConfigEditor.FilterToDefaultInstance(System.String,System.String)} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.XmlMapping.ConfigEditor.CreateDefaultProfile(StructureMap.Graph.Profile)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.XmlMapping.ConfigEditor.RemovePlugin(System.String,System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.XmlMapping.ConfigEditor.RemovePluginFamily(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.XmlMapping.ConfigEditor.RemoveAssembly(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.XmlMapping.ConfigEditor} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Caching.EagerInstanceCache"> - <Warning>WARNING: In the context of this application, the type {StructureMap.Caching.EagerInstanceCache} is never used.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Caching.CacheItem"> - <Warning>WARNING: In the context of this application, the method {StructureMap.Caching.CacheItem.getValue()} could have the visibility {private} instead of the visibility {protected}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Caching.CacheItem.setValue(System.Object)} could have the visibility {private} instead of the visibility {protected}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Caching.CacheItem..ctor(System.Object)} could have the visibility {protected} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.DeploymentTasks.Versioning.DotNetAssembly"> - <Warning>WARNING: In the context of this application, the method {StructureMap.DeploymentTasks.Versioning.DotNetAssembly.CheckVersion(StructureMap.DeploymentTasks.Versioning.DeployedDirectory,StructureMap.DeploymentTasks.Versioning.IVersionReport)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.DeploymentTasks.Versioning.DotNetAssembly.TryCreateAssembly(System.IO.FileInfo)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.Versioning.DotNetAssembly.get_Version()} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.Versioning.DotNetAssembly.get_AssemblyName()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.DeploymentTasks.Versioning.DotNetAssembly..ctor(System.Reflection.Assembly)} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.DeploymentTasks.Versioning.DotNetAssembly} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Interceptors.ThreadLocalStorageInterceptor"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Interceptors.ThreadLocalStorageInterceptor..ctor()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Interceptors.ThreadLocalStorageInterceptor} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Client.Views.BasicView"> - <Warning>WARNING: In the context of this application, the method {StructureMap.Client.Views.BasicView.GetHeaderText(StructureMap.Configuration.GraphObject)} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Client.Views.BasicView} is never used.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Client.Views.HTMLBuilder"> - <Warning>WARNING: In the context of this application, the method {StructureMap.Client.Views.HTMLBuilder.AddDivider()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Client.Views.HTMLBuilder.AddTable()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Client.Views.HTMLBuilder.AddSubHeader(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Client.Views.HTMLBuilder.get_HTML()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Client.Views.HTMLBuilder.StartTable()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Client.Views.HTMLBuilder.AddHeader(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Client.Views.HTMLBuilder..ctor()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Client.Views.HTMLBuilder} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.ObjectFactoryCacheCallback"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.ObjectFactoryCacheCallback..ctor()} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Graph.TypePath"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Graph.TypePath..ctor(System.Type)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Graph.TypePath.CanFindType()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Graph.TypePath.FindType()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.TypePath.get_AssemblyName()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.TypePath.get_ClassName()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Graph.TypePath.CreateFromXmlNode(System.Xml.XmlNode)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Graph.TypePath..ctor(System.String,System.String)} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Graph.TypePath} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Graph.MachineOverride"> - <Warning>WARNING: In the context of this application, the method {StructureMap.Graph.MachineOverride.FilterOutNonExistentPluginTypes(StructureMap.Configuration.PluginGraphReport)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.MachineOverride.get_Defaults()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.MachineOverride.get_DefaultKey(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Graph.MachineOverride.HasOverride(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Graph.MachineOverride.AddMachineOverride(System.String,System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.MachineOverride.get_MachineName()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Graph.MachineOverride..ctor(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Graph.MachineOverride..ctor(System.String,StructureMap.Graph.Profile)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Graph.MachineOverride} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Emitting.DynamicAssembly"> - <Warning>WARNING: In the context of this application, the method {StructureMap.Emitting.DynamicAssembly.Compile()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Emitting.DynamicAssembly.AddClass(System.String,System.Type)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Emitting.DynamicAssembly.get_Name()} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Emitting.DynamicAssembly..ctor(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Emitting.DynamicAssembly} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Configuration.DiagnosticGraphBuilder"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Configuration.DiagnosticGraphBuilder..ctor(StructureMap.Graph.InstanceDefaultManager)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Configuration.DiagnosticGraphBuilder.get_Report()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Configuration.DiagnosticGraphBuilder} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Graph.RemoteGraph"> - <Warning>WARNING: In the context of this application, the method {StructureMap.Graph.RemoteGraph.Load(System.String,System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Client.Shell.SearchPart"> - <Warning>WARNING: In the context of this application, the method {StructureMap.Client.Shell.SearchPart.FindNode(StructureMap.Client.TreeNodes.GraphObjectNode)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Client.Shell.SearchPart.ParseParts(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Client.Shell.SearchPart..ctor(System.String,System.String)} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Client.Shell.SearchPart} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.DeploymentTasks.ImportFamilyTask"> - <Warning>WARNING: In the context of this application, the method {StructureMap.DeploymentTasks.ImportFamilyTask.ImportFamilyNode(System.Xml.XmlDocument,System.Xml.XmlDocument)} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.ImportFamilyTask.set_PluginType(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.ImportFamilyTask.get_PluginType()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.ImportFamilyTask.set_SourcePath(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.ImportFamilyTask.get_SourcePath()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.ImportFamilyTask.set_TargetPath(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.ImportFamilyTask.get_TargetPath()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.DeploymentTasks.ImportFamilyTask} is never used.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.MockInstanceFactory"> - <Warning>WARNING: In the context of this application, the method {StructureMap.MockInstanceFactory.GetMock()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.MockInstanceFactory..ctor(StructureMap.IInstanceFactory)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.MockInstanceFactory} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Graph.InstanceDefault"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Graph.InstanceDefault..ctor(System.String,System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.InstanceDefault.get_DefaultKey()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.InstanceDefault.get_PluginTypeName()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Graph.InstanceDefault} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Caching.ICacheItem"> - <Warning>WARNING: In the context of this application, the type {StructureMap.Caching.ICacheItem} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Emitting.ClassBuilder"> - <Warning>WARNING: In the context of this application, the method {StructureMap.Emitting.ClassBuilder.AddReadonlyStringProperty(System.String,System.String,System.Boolean)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Emitting.ClassBuilder.get_ClassName()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Emitting.ClassBuilder.AddMethod(StructureMap.Emitting.Method)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Emitting.ClassBuilder..ctor(System.Reflection.Emit.ModuleBuilder,System.String,System.Type)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Emitting.ClassBuilder..ctor(System.Reflection.Emit.ModuleBuilder,System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Emitting.ClassBuilder} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Configuration.Tokens.ArgumentType"> - <Warning>WARNING: In the context of this application, the type {StructureMap.Configuration.Tokens.ArgumentType} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Caching.FileModificationWatcher"> - <Warning>WARNING: In the context of this application, the method {StructureMap.Caching.FileModificationWatcher.SubjectNameFromFilePath(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Caching.FileModificationWatcher..ctor(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Caching.FileModificationWatcher} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Caching.CloneStorageStrategy"> - <Warning>WARNING: In the context of this application, the type {StructureMap.Caching.CloneStorageStrategy} is never used.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Graph.PluginFamily"> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.PluginFamily.get_PluginTypeName()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Graph.PluginFamily.SearchAssemblyGraph(StructureMap.Graph.AssemblyGraph)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Graph.PluginFamily.set_DefinitionSource(StructureMap.Graph.DefinitionSource)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.PluginFamily.get_DefaultInstanceKey()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.PluginFamily.get_PluginType()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Graph.PluginFamily.CreateAutoFilledPluginFamily(System.Type)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Graph.PluginFamily.RemoveImplicitChildren()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.PluginFamily.get_Plugins()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Graph.PluginFamily.set_InterceptionChain(StructureMap.Graph.InterceptionChain)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.PluginFamily.get_InterceptionChain()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Graph.PluginFamily.set_Source(StructureMap.MementoSource)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.PluginFamily.get_Source()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.PluginFamily.get_DefinitionSource()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Graph.PluginFamily.set_DefaultInstanceKey(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Graph.PluginFamily..ctor(StructureMap.Graph.TypePath,System.String)} could have the visibility {internal} instead of the visibi... [truncated message content] |
From: <jer...@us...> - 2008-04-11 23:31:25
|
Revision: 78 http://structuremap.svn.sourceforge.net/structuremap/?rev=78&view=rev Author: jeremydmiller Date: 2008-04-11 16:31:23 -0700 (Fri, 11 Apr 2008) Log Message: ----------- The Great Refactoring of 2008. Generics are temporarily broken however Modified Paths: -------------- trunk/Source/StructureMap/Attributes/PluginFamilyAttribute.cs trunk/Source/StructureMap/Configuration/ConfigurationParser.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/CreatePluginFamilyExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceDefaultExpression.cs trunk/Source/StructureMap/Configuration/DSL/Registry.cs trunk/Source/StructureMap/Configuration/FamilyParser.cs trunk/Source/StructureMap/Configuration/IGraphBuilder.cs trunk/Source/StructureMap/Configuration/Mementos/ExplicitArguments.cs trunk/Source/StructureMap/Configuration/Mementos/LiteralMemento.cs trunk/Source/StructureMap/Configuration/Mementos/MemoryInstanceMemento.cs trunk/Source/StructureMap/Configuration/Mementos/PrototypeMemento.cs trunk/Source/StructureMap/Configuration/Mementos/UserControlMemento.cs trunk/Source/StructureMap/Configuration/NormalGraphBuilder.cs trunk/Source/StructureMap/Configuration/XmlConstants.cs trunk/Source/StructureMap/Graph/AssemblyGraph.cs trunk/Source/StructureMap/Graph/AssemblyGraphCollection.cs trunk/Source/StructureMap/Graph/GenericsPluginGraph.cs trunk/Source/StructureMap/Graph/InterceptionChain.cs trunk/Source/StructureMap/Graph/Plugin.cs trunk/Source/StructureMap/Graph/PluginCollection.cs trunk/Source/StructureMap/Graph/PluginFamily.cs trunk/Source/StructureMap/Graph/PluginFamilyCollection.cs trunk/Source/StructureMap/Graph/PluginGraph.cs trunk/Source/StructureMap/Graph/SetterPropertyCollection.cs trunk/Source/StructureMap/IInstanceFactory.cs trunk/Source/StructureMap/IInstanceManager.cs trunk/Source/StructureMap/InstanceFactory.cs trunk/Source/StructureMap/InstanceManager.cs trunk/Source/StructureMap/InstanceMemento.cs trunk/Source/StructureMap/Interceptors/CompoundInterceptor.cs trunk/Source/StructureMap/Interceptors/HybridCacheInterceptor.cs trunk/Source/StructureMap/Interceptors/InstanceFactoryInterceptor.cs trunk/Source/StructureMap/ObjectFactory.cs trunk/Source/StructureMap/Pipeline/ConfiguredInstance.cs trunk/Source/StructureMap/Pipeline/DefaultInstance.cs trunk/Source/StructureMap/Pipeline/Instance.cs trunk/Source/StructureMap/Pipeline/LiteralInstance.cs trunk/Source/StructureMap/Pipeline/PrototypeInstance.cs trunk/Source/StructureMap/Pipeline/ReferencedInstance.cs trunk/Source/StructureMap/Pipeline/UserControlInstance.cs trunk/Source/StructureMap/Source/XmlAttributeInstanceMemento.cs trunk/Source/StructureMap/Source/XmlNodeInstanceMemento.cs trunk/Source/StructureMap/StructureMap.csproj trunk/Source/StructureMap/StructureMapConfiguration.cs trunk/Source/StructureMap/StructureMapException.resx trunk/Source/StructureMap.Testing/AlternativeConfigurationTester.cs trunk/Source/StructureMap.Testing/Attributes/PluginFamilyAttributeTester.cs trunk/Source/StructureMap.Testing/Caching/StorageAndCacheItemTester.cs trunk/Source/StructureMap.Testing/Configuration/ConfigurationParserCollectionTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/AddInstanceTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/CreateProfileTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/DeepInstanceTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/InstanceExpressionTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/InterceptAllInstancesOfPluginTypeTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/InterceptorTesting.cs trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryIntegratedTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryTester.cs trunk/Source/StructureMap.Testing/Configuration/DefaultInstanceNodeTester.cs trunk/Source/StructureMap.Testing/Configuration/FamilyParserTester.cs trunk/Source/StructureMap.Testing/Configuration/IncludeTesting.cs trunk/Source/StructureMap.Testing/Configuration/NormalGraphBuilderTester.cs trunk/Source/StructureMap.Testing/Configuration/ShortcuttedInstanceNodeTester.cs trunk/Source/StructureMap.Testing/Container/ArrayConstructorTester.cs trunk/Source/StructureMap.Testing/Container/DynamicInjectionTester.cs trunk/Source/StructureMap.Testing/Container/EmittingTester.cs trunk/Source/StructureMap.Testing/Container/EnumerationTester.cs trunk/Source/StructureMap.Testing/Container/ExceptionHandling/ExceptionTestRunner.cs trunk/Source/StructureMap.Testing/Container/ExplicitArgumentTester.cs trunk/Source/StructureMap.Testing/Container/FillDependenciesTester.cs trunk/Source/StructureMap.Testing/Container/InstanceFactoryTester.cs trunk/Source/StructureMap.Testing/Container/InstanceManagerTester.cs trunk/Source/StructureMap.Testing/Container/IntegratedTester.cs trunk/Source/StructureMap.Testing/Container/MockingTester.cs trunk/Source/StructureMap.Testing/Container/PluginGraphBuilderTester.cs trunk/Source/StructureMap.Testing/Container/SetterInjectionEmittingTester.cs trunk/Source/StructureMap.Testing/DataAccess/DataSessionTester.cs trunk/Source/StructureMap.Testing/GenericsAcceptanceTester.cs trunk/Source/StructureMap.Testing/GenericsIntegrationTester.cs trunk/Source/StructureMap.Testing/Graph/AssemblyGraphTester.cs trunk/Source/StructureMap.Testing/Graph/GenericsPluginGraphTester.cs trunk/Source/StructureMap.Testing/Graph/PluginFamilyTester.cs trunk/Source/StructureMap.Testing/Graph/PluginGraphTester.cs trunk/Source/StructureMap.Testing/Graph/PluginTester.cs trunk/Source/StructureMap.Testing/ImplicitPluginFromPluggedTypeAttributeTester.cs trunk/Source/StructureMap.Testing/ObjectMother.cs trunk/Source/StructureMap.Testing/Pipeline/DefaultInstanceTester.cs trunk/Source/StructureMap.Testing/Pipeline/InstanceTester.cs trunk/Source/StructureMap.Testing/Pipeline/LiteralInstanceTester.cs trunk/Source/StructureMap.Testing/Pipeline/ReferencedInstanceTester.cs trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj trunk/Source/StructureMap.Testing/StructureMap.config trunk/Source/StructureMap.Testing/StructureMapConfigurationTester.cs trunk/Source/StructureMap.Testing/TestData/AttributeNormalized.xml trunk/Source/StructureMap.Testing/TestData/ExceptionHandlingTests.xml trunk/Source/StructureMap.Testing/TestData/Master.xml trunk/Source/StructureMap.Testing/TestData/SampleConfig.xml trunk/Source/StructureMap.Testing/TestData/StructureMap.config trunk/Source/StructureMap.Testing.Widget/Rule.cs trunk/Source/StructureMap.Testing.Widget3/IService.cs trunk/StructureMap.config Modified: trunk/Source/StructureMap/Attributes/PluginFamilyAttribute.cs =================================================================== --- trunk/Source/StructureMap/Attributes/PluginFamilyAttribute.cs 2008-04-07 15:00:00 UTC (rev 77) +++ trunk/Source/StructureMap/Attributes/PluginFamilyAttribute.cs 2008-04-11 23:31:23 UTC (rev 78) @@ -143,7 +143,8 @@ } MementoSource source = CreateSource(exportedType); - PluginFamily family = new PluginFamily(exportedType, DefaultKey, source); + PluginFamily family = new PluginFamily(exportedType, DefaultKey); + family.AddMementoSource(source); InterceptorChainBuilder builder = new InterceptorChainBuilder(); family.InterceptionChain = builder.Build(Scope); @@ -156,8 +157,6 @@ PluginFamilyAttribute att = GetAttribute(exportedType); PluginFamily family = att.BuildPluginFamily(exportedType); - family.DefinitionSource = DefinitionSource.Implicit; - return family; } Modified: trunk/Source/StructureMap/Configuration/ConfigurationParser.cs =================================================================== --- trunk/Source/StructureMap/Configuration/ConfigurationParser.cs 2008-04-07 15:00:00 UTC (rev 77) +++ trunk/Source/StructureMap/Configuration/ConfigurationParser.cs 2008-04-11 23:31:23 UTC (rev 78) @@ -63,25 +63,7 @@ return (ConfigurationParser[]) list.ToArray(typeof (ConfigurationParser)); } - public static string[] GetDeploymentTargets(XmlNode node) - { - string[] returnValue = new string[0]; - XmlAttribute att = node.Attributes[XmlConstants.DEPLOYMENT_ATTRIBUTE]; - if (att != null) - { - string deployTargetArray = att.Value; - - deployTargetArray = deployTargetArray.Replace(" ,", ","); - deployTargetArray = deployTargetArray.Replace(", ", ","); - - - returnValue = deployTargetArray.Split(','); - } - - return returnValue; - } - public static ConfigurationParser FromFile(string filename) { XmlDocument document = new XmlDocument(); @@ -135,8 +117,6 @@ public void ParseInstances(IGraphBuilder builder) { - parseInstances(builder); - XmlNodeList familyNodes = findNodes(XmlConstants.PLUGIN_FAMILY_NODE); foreach (XmlElement familyElement in familyNodes) { @@ -151,9 +131,8 @@ foreach (XmlNode assemblyNode in assemblyNodes) { string assemblyName = assemblyNode.Attributes[XmlConstants.NAME].Value; - string[] deploymentTargets = GetDeploymentTargets(assemblyNode); - builder.AddAssembly(assemblyName, deploymentTargets); + builder.AddAssembly(assemblyName); } } @@ -201,26 +180,6 @@ } } - private void parseInstances(IGraphBuilder builder) - { - XmlNode instancesNode = _structureMapNode[XmlConstants.INSTANCES_NODE]; - if (instancesNode == null) - { - return; - } - - foreach (XmlNode instanceNode in instancesNode) - { - string pluginTypeName = instanceNode.Name; - TypePath typePath = TypePath.TypePathForFullName(pluginTypeName); - - InstanceMemento memento = _mementoCreator.CreateMemento(instanceNode); - - builder.RegisterMemento(typePath, memento); - } - } - - public void ParseProfilesAndMachines(IGraphBuilder builder) { ProfileAndMachineParser parser = new ProfileAndMachineParser(builder, _structureMapNode, _mementoCreator); Modified: trunk/Source/StructureMap/Configuration/DSL/Expressions/CreatePluginFamilyExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/CreatePluginFamilyExpression.cs 2008-04-07 15:00:00 UTC (rev 77) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/CreatePluginFamilyExpression.cs 2008-04-11 23:31:23 UTC (rev 78) @@ -3,6 +3,7 @@ using StructureMap.Attributes; using StructureMap.Graph; using StructureMap.Interceptors; +using StructureMap.Pipeline; namespace StructureMap.Configuration.DSL.Expressions { @@ -54,30 +55,23 @@ /// </summary> /// <param name="builder"></param> /// <returns></returns> - public CreatePluginFamilyExpression<PLUGINTYPE> TheDefaultIs(IMementoBuilder builder) + public CreatePluginFamilyExpression<PLUGINTYPE> TheDefaultIs(Instance instance) { - builder.ValidatePluggability(_pluginType); - - _children.Add(builder); _alterations.Add(delegate(PluginFamily family) { - InstanceMemento memento = builder.BuildMemento(family); - family.Source.AddExternalMemento(memento); - family.DefaultInstanceKey = memento.InstanceKey; + family.AddInstance(instance); + family.DefaultInstanceKey = instance.Name; }); return this; } - public CreatePluginFamilyExpression<PLUGINTYPE> AddInstance(IMementoBuilder builder) + public CreatePluginFamilyExpression<PLUGINTYPE> AddInstance(Instance instance) { - builder.ValidatePluggability(_pluginType); - - _children.Add(builder); + // TODO: Validate pluggability _alterations.Add(delegate(PluginFamily family) { - InstanceMemento memento = builder.BuildMemento(family); - family.Source.AddExternalMemento(memento); + family.AddInstance(instance); }); return this; @@ -144,7 +138,10 @@ public CreatePluginFamilyExpression<PLUGINTYPE> EnrichWith(EnrichmentHandler<PLUGINTYPE> handler) { _alterations.Add( - delegate(PluginFamily family) { family.InstanceInterceptor = new EnrichmentInterceptor<PLUGINTYPE>(handler); }); + delegate(PluginFamily family) + { + family.InstanceInterceptor = new EnrichmentInterceptor<PLUGINTYPE>(handler); + }); return this; } @@ -161,7 +158,7 @@ { Plugin plugin = Plugin.CreateImplicitPlugin(typeof (CONCRETETYPE)); plugin.ConcreteKey = instanceName; - family.Plugins.Add(plugin, true); + family.Plugins.Add(plugin); } ); Modified: trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceDefaultExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceDefaultExpression.cs 2008-04-07 15:00:00 UTC (rev 77) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceDefaultExpression.cs 2008-04-11 23:31:23 UTC (rev 78) @@ -1,5 +1,6 @@ using System; using StructureMap.Graph; +using StructureMap.Pipeline; namespace StructureMap.Configuration.DSL.Expressions { @@ -11,7 +12,7 @@ private readonly ProfileExpression _parent; private readonly Type _pluginType; private string _instanceKey = string.Empty; - private IMementoBuilder _mementoBuilder; + private Instance _instance; public InstanceDefaultExpression(Type pluginType, ProfileExpression parent) { @@ -37,14 +38,13 @@ InstanceDefault instanceDefault = new InstanceDefault(_pluginType, _instanceKey); profile.AddOverride(instanceDefault); } - else if (_mementoBuilder != null) + else if (_instance != null) { string defaultKey = Profile.InstanceKeyForProfile(profile.ProfileName); - InstanceMemento memento = _mementoBuilder.BuildMemento(graph); - memento.InstanceKey = defaultKey; + + _instance.Name = defaultKey; + graph.LocateOrCreateFamilyForType(_pluginType).AddInstance(_instance); - graph.PluginFamilies[_pluginType].AddInstance(memento); - InstanceDefault instanceDefault = new InstanceDefault(_pluginType, defaultKey); profile.AddOverride(instanceDefault); } @@ -59,9 +59,9 @@ /// </summary> /// <param name="mementoBuilder"></param> /// <returns></returns> - public ProfileExpression Use(IMementoBuilder mementoBuilder) + public ProfileExpression Use(Instance instance) { - _mementoBuilder = mementoBuilder; + _instance = instance; return _parent; } Modified: trunk/Source/StructureMap/Configuration/DSL/Registry.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Registry.cs 2008-04-07 15:00:00 UTC (rev 77) +++ trunk/Source/StructureMap/Configuration/DSL/Registry.cs 2008-04-11 23:31:23 UTC (rev 78) @@ -3,6 +3,7 @@ using StructureMap.Configuration.DSL.Expressions; using StructureMap.Graph; using StructureMap.Interceptors; +using StructureMap.Pipeline; namespace StructureMap.Configuration.DSL { @@ -102,23 +103,30 @@ /// </summary> /// <typeparam name="PLUGINTYPE"></typeparam> /// <returns></returns> - public InstanceExpression.InstanceTypeExpression AddInstanceOf<PLUGINTYPE>() + public ConfiguredInstance AddInstanceOf<PLUGINTYPE>() { - InstanceExpression expression = new InstanceExpression(typeof (PLUGINTYPE)); - addExpression(expression); - return expression.TypeExpression(); + ConfiguredInstance instance = new ConfiguredInstance(); + + addExpression(delegate (PluginGraph pluginGraph) + { + pluginGraph.LocateOrCreateFamilyForType(typeof(PLUGINTYPE)).AddInstance(instance); + }); + + return instance; } /// <summary> /// Convenience method to start the definition of an instance of type T /// </summary> - /// <typeparam name="PLUGINTYPE"></typeparam> + /// <typeparam name="PLUGGEDTYPE"></typeparam> /// <returns></returns> - public static InstanceExpression.InstanceTypeExpression Instance<PLUGINTYPE>() + public static ConfiguredInstance Instance<PLUGGEDTYPE>() { - InstanceExpression expression = new InstanceExpression(typeof (PLUGINTYPE)); - return expression.TypeExpression(); + ConfiguredInstance instance = new ConfiguredInstance(); + instance.PluggedType = typeof (PLUGGEDTYPE); + + return instance; } /// <summary> @@ -127,9 +135,9 @@ /// <typeparam name="PLUGINTYPE"></typeparam> /// <param name="prototype"></param> /// <returns></returns> - public static PrototypeExpression<PLUGINTYPE> Prototype<PLUGINTYPE>(PLUGINTYPE prototype) + public static PrototypeInstance Prototype<PLUGINTYPE>(PLUGINTYPE prototype) { - return new PrototypeExpression<PLUGINTYPE>(prototype); + return new PrototypeInstance((ICloneable) prototype); } /// <summary> @@ -138,9 +146,9 @@ /// <typeparam name="PLUGINTYPE"></typeparam> /// <param name="instance"></param> /// <returns></returns> - public static LiteralExpression<PLUGINTYPE> Object<PLUGINTYPE>(PLUGINTYPE instance) + public static LiteralInstance Object<PLUGINTYPE>(PLUGINTYPE instance) { - return new LiteralExpression<PLUGINTYPE>(instance); + return new LiteralInstance(instance); } /// <summary> @@ -149,10 +157,10 @@ /// <typeparam name="PLUGINTYPE"></typeparam> /// <param name="target"></param> /// <returns></returns> - public LiteralExpression<PLUGINTYPE> AddInstanceOf<PLUGINTYPE>(PLUGINTYPE target) + public LiteralInstance AddInstanceOf<PLUGINTYPE>(PLUGINTYPE target) { - LiteralExpression<PLUGINTYPE> literal = new LiteralExpression<PLUGINTYPE>(target); - addExpression(literal); + LiteralInstance literal = new LiteralInstance(target); + _graph.LocateOrCreateFamilyForType(typeof(PLUGINTYPE)).AddInstance(literal); return literal; } @@ -163,10 +171,10 @@ /// <typeparam name="PLUGINTYPE"></typeparam> /// <param name="prototype"></param> /// <returns></returns> - public PrototypeExpression<PLUGINTYPE> AddPrototypeInstanceOf<PLUGINTYPE>(PLUGINTYPE prototype) + public PrototypeInstance AddPrototypeInstanceOf<PLUGINTYPE>(PLUGINTYPE prototype) { - PrototypeExpression<PLUGINTYPE> expression = new PrototypeExpression<PLUGINTYPE>(prototype); - addExpression(expression); + PrototypeInstance expression = new PrototypeInstance((ICloneable) prototype); + _graph.LocateOrCreateFamilyForType(typeof(PLUGINTYPE)).AddInstance(expression); return expression; } @@ -177,9 +185,9 @@ /// <typeparam name="PLUGINTYPE"></typeparam> /// <param name="url"></param> /// <returns></returns> - public static UserControlExpression LoadUserControlFrom<PLUGINTYPE>(string url) + public static UserControlInstance LoadUserControlFrom<PLUGINTYPE>(string url) { - return new UserControlExpression(typeof (PLUGINTYPE), url); + return new UserControlInstance(url); } /// <summary> @@ -216,23 +224,25 @@ /// <typeparam name="PLUGINTYPE"></typeparam> /// <param name="url"></param> /// <returns></returns> - public UserControlExpression LoadControlFromUrl<PLUGINTYPE>(string url) + public UserControlInstance LoadControlFromUrl<PLUGINTYPE>(string url) { - UserControlExpression expression = new UserControlExpression(typeof (PLUGINTYPE), url); - addExpression(expression); + UserControlInstance instance = new UserControlInstance(url); - return expression; + PluginFamily family = _graph.LocateOrCreateFamilyForType(typeof (PLUGINTYPE)); + family.AddInstance(instance); + + return instance; } - public static ConstructorExpression<PLUGINTYPE> ConstructedBy<PLUGINTYPE> - (BuildObjectDelegate<PLUGINTYPE> builder) + public static ConstructorInstance ConstructedBy<PLUGINTYPE> + (BuildObjectDelegate builder) { - return new ConstructorExpression<PLUGINTYPE>(builder); + return new ConstructorInstance(builder); } - public static ReferenceMementoBuilder Instance(string referencedKey) + public static ReferencedInstance Instance(string referencedKey) { - return new ReferenceMementoBuilder(referencedKey); + return new ReferencedInstance(referencedKey); } public void RegisterInterceptor(TypeInterceptor interceptor) Modified: trunk/Source/StructureMap/Configuration/FamilyParser.cs =================================================================== --- trunk/Source/StructureMap/Configuration/FamilyParser.cs 2008-04-07 15:00:00 UTC (rev 77) +++ trunk/Source/StructureMap/Configuration/FamilyParser.cs 2008-04-11 23:31:23 UTC (rev 78) @@ -21,12 +21,11 @@ { TypePath typePath = TypePath.CreateFromXmlNode(familyElement); string defaultKey = familyElement.GetAttribute(XmlConstants.DEFAULT_KEY_ATTRIBUTE); - string[] deploymentTargets = ConfigurationParser.GetDeploymentTargets(familyElement); InstanceScope scope = findScope(familyElement); - _builder.AddPluginFamily(typePath, defaultKey, deploymentTargets, scope); + _builder.AddPluginFamily(typePath, defaultKey, scope); attachMementoSource(familyElement, typePath); attachPlugins(typePath, familyElement); @@ -46,7 +45,7 @@ InstanceMemento memento = _mementoCreator.CreateMemento(element); memento.InstanceKey = name; - _builder.AddPluginFamily(pluginTypePath, name, new string[0], scope); + _builder.AddPluginFamily(pluginTypePath, name, scope); _builder.RegisterMemento(pluginTypePath, memento); } @@ -57,7 +56,6 @@ InstanceMemento memento = _mementoCreator.CreateMemento(element); - _builder.AddPluginFamily(pluginTypePath, null, new string[0], scope); _builder.RegisterMemento(pluginTypePath, memento); } Modified: trunk/Source/StructureMap/Configuration/IGraphBuilder.cs =================================================================== --- trunk/Source/StructureMap/Configuration/IGraphBuilder.cs 2008-04-07 15:00:00 UTC (rev 77) +++ trunk/Source/StructureMap/Configuration/IGraphBuilder.cs 2008-04-11 23:31:23 UTC (rev 78) @@ -8,11 +8,11 @@ PluginGraph SystemGraph { get; } InstanceDefaultManager DefaultManager { get; } PluginGraph PluginGraph { get; } - void AddAssembly(string assemblyName, string[] deployableTargets); + void AddAssembly(string assemblyName); void StartFamilies(); - void AddPluginFamily(TypePath typePath, string defaultKey, string[] deploymentTargets, InstanceScope scope); + void AddPluginFamily(TypePath typePath, string defaultKey, InstanceScope scope); void AttachSource(TypePath pluginTypePath, InstanceMemento sourceMemento); void AttachSource(TypePath pluginTypePath, MementoSource source); Plugin AddPlugin(TypePath pluginTypePath, TypePath pluginPath, string concreteKey); Modified: trunk/Source/StructureMap/Configuration/Mementos/ExplicitArguments.cs =================================================================== --- trunk/Source/StructureMap/Configuration/Mementos/ExplicitArguments.cs 2008-04-07 15:00:00 UTC (rev 77) +++ trunk/Source/StructureMap/Configuration/Mementos/ExplicitArguments.cs 2008-04-11 23:31:23 UTC (rev 78) @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using StructureMap.Pipeline; namespace StructureMap.Configuration.Mementos { @@ -32,5 +33,62 @@ { return _args.ContainsKey(key) ? _args[key] : null; } + + public void Configure(ConfiguredInstance instance) + { + foreach (KeyValuePair<string, string> arg in _args) + { + instance.SetProperty(arg.Key, arg.Value); + instance.SetChild(arg.Key, new LiteralInstance(arg.Value)); + } + } + + public bool Has(Type type) + { + return _children.ContainsKey(type); + } + + public bool Has(string propertyName) + { + return _args.ContainsKey(propertyName); + } } + + public class ExplicitInstance<PLUGINTYPE> : ConfiguredInstance + { + private readonly ExplicitArguments _args; + + public ExplicitInstance(ExplicitArguments args, Instance defaultInstance) + { + args.Configure(this); + _args = args; + + ConfiguredInstance defaultConfiguration = defaultInstance as ConfiguredInstance; + if (defaultConfiguration != null) + { + merge(defaultConfiguration); + PluggedType = defaultConfiguration.PluggedType; + } + else + { + PluggedType = typeof(PLUGINTYPE); + } + } + + + protected override object getChild(string propertyName, Type pluginType, IInstanceCreator instanceCreator) + { + if (_args.Has(pluginType)) + { + return _args.Get(pluginType); + } + + if (_args.Has(propertyName)) + { + return _args.GetArg(propertyName); + } + + return base.getChild(propertyName, pluginType, instanceCreator); + } + } } \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/Mementos/LiteralMemento.cs =================================================================== --- trunk/Source/StructureMap/Configuration/Mementos/LiteralMemento.cs 2008-04-07 15:00:00 UTC (rev 77) +++ trunk/Source/StructureMap/Configuration/Mementos/LiteralMemento.cs 2008-04-11 23:31:23 UTC (rev 78) @@ -1,7 +1,10 @@ using System; +using StructureMap.Graph; +using StructureMap.Pipeline; namespace StructureMap.Configuration.Mementos { + [Obsolete("Eliminate!")] public class LiteralMemento : InstanceMemento { private object _instance; @@ -59,9 +62,16 @@ throw new NotImplementedException(); } - protected override object buildInstance(IInstanceCreator creator) + + protected override Instance readInstance(PluginGraph pluginGraph, Type pluginType) { - return _instance; + return new LiteralInstance(_instance); } + + + public override Plugin FindPlugin(PluginFamily family) + { + return null; + } } } \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/Mementos/MemoryInstanceMemento.cs =================================================================== --- trunk/Source/StructureMap/Configuration/Mementos/MemoryInstanceMemento.cs 2008-04-07 15:00:00 UTC (rev 77) +++ trunk/Source/StructureMap/Configuration/Mementos/MemoryInstanceMemento.cs 2008-04-11 23:31:23 UTC (rev 78) @@ -1,10 +1,12 @@ +using System; using System.Collections; using System.Collections.Specialized; using StructureMap.Graph; +using StructureMap.Pipeline; namespace StructureMap.Configuration.Mementos { - public class GenericMemento<T> : MemoryInstanceMemento + [Obsolete("Think this is unnecessary")] public class GenericMemento<T> : MemoryInstanceMemento { public GenericMemento(string instanceKey) : base(Plugin.CreateImplicitPlugin(typeof (T)).ConcreteKey, instanceKey) @@ -51,7 +53,7 @@ #endregion private readonly Hashtable _children = new Hashtable(); - private readonly string _concreteKey; + private string _concreteKey; private readonly NameValueCollection _properties = new NameValueCollection(); private string _instanceKey; private bool _isReference; @@ -95,6 +97,12 @@ get { return _concreteKey; } } + [Obsolete("Temporary")] + public void SetConcreteKey(string concreteKey) + { + _concreteKey = concreteKey; + } + /// <summary> /// See <cref>InstanceMemento</cref> /// </summary> Modified: trunk/Source/StructureMap/Configuration/Mementos/PrototypeMemento.cs =================================================================== --- trunk/Source/StructureMap/Configuration/Mementos/PrototypeMemento.cs 2008-04-07 15:00:00 UTC (rev 77) +++ trunk/Source/StructureMap/Configuration/Mementos/PrototypeMemento.cs 2008-04-11 23:31:23 UTC (rev 78) @@ -1,7 +1,10 @@ using System; +using StructureMap.Graph; +using StructureMap.Pipeline; namespace StructureMap.Configuration.Mementos { + [Obsolete("Eliminate!")] public class PrototypeMemento : InstanceMemento { private readonly string _instanceKey; @@ -13,6 +16,10 @@ _prototype = prototype; } + public override Plugin FindPlugin(PluginFamily family) + { + return null; + } public ICloneable Prototype { @@ -40,10 +47,6 @@ get { throw new NotImplementedException(); } } - protected override object buildInstance(IInstanceCreator creator) - { - return _prototype.Clone(); - } protected override string getPropertyValue(string Key) { @@ -59,5 +62,11 @@ { throw new NotImplementedException(); } + + + protected override Instance readInstance(PluginGraph pluginGraph, Type pluginType) + { + return new PrototypeInstance(_prototype); + } } } \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/Mementos/UserControlMemento.cs =================================================================== --- trunk/Source/StructureMap/Configuration/Mementos/UserControlMemento.cs 2008-04-07 15:00:00 UTC (rev 77) +++ trunk/Source/StructureMap/Configuration/Mementos/UserControlMemento.cs 2008-04-11 23:31:23 UTC (rev 78) @@ -1,8 +1,10 @@ using System; using System.Web.UI; +using StructureMap.Pipeline; namespace StructureMap.Configuration.Mementos { + [Obsolete("Eliminate")] public class UserControlMemento : InstanceMemento { private readonly string _instanceKey; @@ -45,11 +47,6 @@ get { throw new NotImplementedException(); } } - protected override object buildInstance(IInstanceCreator creator) - { - return new Page().LoadControl(_url); - } - protected override string getPropertyValue(string Key) { throw new NotImplementedException(); Modified: trunk/Source/StructureMap/Configuration/NormalGraphBuilder.cs =================================================================== --- trunk/Source/StructureMap/Configuration/NormalGraphBuilder.cs 2008-04-07 15:00:00 UTC (rev 77) +++ trunk/Source/StructureMap/Configuration/NormalGraphBuilder.cs 2008-04-11 23:31:23 UTC (rev 78) @@ -1,9 +1,11 @@ using System; +using System.Diagnostics; using System.Reflection; using StructureMap.Attributes; using StructureMap.Configuration.DSL; using StructureMap.Graph; using StructureMap.Interceptors; +using StructureMap.Pipeline; namespace StructureMap.Configuration { @@ -101,10 +103,9 @@ return _pluginGraph.LocateOrCreateFamilyForType(fullName); } - public void AddAssembly(string assemblyName, string[] deployableTargets) + public void AddAssembly(string assemblyName) { AssemblyGraph assemblyGraph = new AssemblyGraph(assemblyName); - assemblyGraph.DeploymentTargets = deployableTargets; _pluginGraph.Assemblies.Add(assemblyGraph); AssemblyGraph systemAssemblyGraph = new AssemblyGraph(assemblyName); @@ -118,13 +119,25 @@ _systemInstanceManager = new InstanceManager(_systemGraph); } - public void AddPluginFamily(TypePath typePath, string defaultKey, string[] deploymentTargets, - InstanceScope scope) + public void AddPluginFamily(TypePath typePath, string defaultKey, InstanceScope scope) { - PluginFamily family = new PluginFamily(typePath, defaultKey); - family.DefinitionSource = DefinitionSource.Explicit; - family.InterceptionChain = _builder.Build(scope); - _pluginGraph.PluginFamilies.Add(family); + Type pluginType; + try + { + pluginType = typePath.FindType(); + } + catch (Exception ex) + { + throw new StructureMapException(103, ex, typePath.ClassName, typePath.AssemblyName); + } + + + PluginFamily family = _pluginGraph.LocateOrCreateFamilyForType(pluginType); + + // Xml configuration wins + family.DefaultInstanceKey = defaultKey; + InterceptionChain interceptionChain = _builder.Build(scope); + family.AddInterceptionChain(interceptionChain); } public virtual void AttachSource(TypePath pluginTypePath, InstanceMemento sourceMemento) @@ -143,7 +156,7 @@ public void AttachSource(TypePath pluginTypePath, MementoSource source) { PluginFamily family = _pluginGraph.PluginFamilies[pluginTypePath]; - family.Source = source; + family.AddMementoSource(source); } public Plugin AddPlugin(TypePath pluginTypePath, TypePath pluginPath, string concreteKey) @@ -157,8 +170,7 @@ } Plugin plugin = new Plugin(pluginPath, concreteKey); - plugin.DefinitionSource = DefinitionSource.Explicit; - family.Plugins.Add(plugin, true); + family.Plugins.Add(plugin); return plugin; } @@ -194,22 +206,16 @@ public void RegisterMemento(TypePath pluginTypePath, InstanceMemento memento) { - PluginFamily family = _pluginGraph.PluginFamilies[pluginTypePath]; - - Plugin inferredPlugin = memento.CreateInferredPlugin(); - if (inferredPlugin != null) - { - family.Plugins.Add(inferredPlugin, true); - } - - family.Source.AddExternalMemento(memento); + PluginFamily family = _pluginGraph.LocateOrCreateFamilyForType(pluginTypePath.FindType()); + family.AddInstance(memento); } #endregion private object buildSystemObject(Type type, InstanceMemento memento) { - return _systemInstanceManager.CreateInstance(type, memento); + Instance instance = memento.ReadInstance(_systemGraph, type); + return _systemInstanceManager.CreateInstance(type, instance); } } } \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/XmlConstants.cs =================================================================== --- trunk/Source/StructureMap/Configuration/XmlConstants.cs 2008-04-07 15:00:00 UTC (rev 77) +++ trunk/Source/StructureMap/Configuration/XmlConstants.cs 2008-04-11 23:31:23 UTC (rev 78) @@ -1,3 +1,5 @@ +using System; + namespace StructureMap.Configuration { /// <summary> @@ -16,7 +18,6 @@ public const string DEPLOYMENT_ATTRIBUTE = "Deploy"; public const string INCLUDE_NODE = "Include"; public const string INSTANCE_NODE = "Instance"; - public const string INSTANCES_NODE = "Instances"; public const string INTERCEPTORS_NODE = "Interceptors"; public const string KEY_ATTRIBUTE = "Key"; public const string MACHINE_NODE = "Machine"; Modified: trunk/Source/StructureMap/Graph/AssemblyGraph.cs =================================================================== --- trunk/Source/StructureMap/Graph/AssemblyGraph.cs 2008-04-07 15:00:00 UTC (rev 77) +++ trunk/Source/StructureMap/Graph/AssemblyGraph.cs 2008-04-11 23:31:23 UTC (rev 78) @@ -11,7 +11,7 @@ /// <summary> /// Models an assembly reference in a PluginGraph /// </summary> - public class AssemblyGraph : Deployable, IComparable + public class AssemblyGraph : IComparable { #region statics Modified: trunk/Source/StructureMap/Graph/AssemblyGraphCollection.cs =================================================================== --- trunk/Source/StructureMap/Graph/AssemblyGraphCollection.cs 2008-04-07 15:00:00 UTC (rev 77) +++ trunk/Source/StructureMap/Graph/AssemblyGraphCollection.cs 2008-04-11 23:31:23 UTC (rev 78) @@ -7,20 +7,15 @@ /// <summary> /// Custom collection for AssemblyGraph's /// </summary> - public class AssemblyGraphCollection : PluginGraphObjectCollection + public class AssemblyGraphCollection : IEnumerable<AssemblyGraph> { private Dictionary<string, AssemblyGraph> _assemblies; - public AssemblyGraphCollection(PluginGraph pluginGraph) : base(pluginGraph) + public AssemblyGraphCollection(PluginGraph pluginGraph) { _assemblies = new Dictionary<string, AssemblyGraph>(); } - protected override ICollection innerCollection - { - get { return _assemblies.Values; } - } - public AssemblyGraph this[string assemblyName] { get { return _assemblies[assemblyName]; } @@ -36,6 +31,11 @@ } } + public int Count + { + get { return _assemblies.Count; } + } + public AssemblyGraph Add(string assemblyName) { AssemblyGraph assemblyGraph = new AssemblyGraph(assemblyName); @@ -49,8 +49,6 @@ public AssemblyGraph Add(AssemblyGraph assemblyGraph) { - verifyNotSealed(); - if (_assemblies.ContainsKey(assemblyGraph.AssemblyName)) { return _assemblies[assemblyGraph.AssemblyName]; @@ -62,7 +60,6 @@ public void Remove(string assemblyName) { - verifyNotSealed(); _assemblies.Remove(assemblyName); } @@ -75,5 +72,15 @@ { return _assemblies.ContainsKey(assemblyName); } + + IEnumerator<AssemblyGraph> IEnumerable<AssemblyGraph>.GetEnumerator() + { + return _assemblies.Values.GetEnumerator(); + } + + public IEnumerator GetEnumerator() + { + return ((IEnumerable<AssemblyGraph>) this).GetEnumerator(); + } } } \ No newline at end of file Modified: trunk/Source/StructureMap/Graph/GenericsPluginGraph.cs =================================================================== --- trunk/Source/StructureMap/Graph/GenericsPluginGraph.cs 2008-04-07 15:00:00 UTC (rev 77) +++ trunk/Source/StructureMap/Graph/GenericsPluginGraph.cs 2008-04-11 23:31:23 UTC (rev 78) @@ -99,13 +99,7 @@ } else { - string configuredTypes = ""; - foreach (KeyValuePair<Type, PluginFamily> pair in _families) - { - configuredTypes += "\n" + pair.Value.PluginTypeName + ";"; - } - - throw new StructureMapException(190, templatedType.FullName, basicType.FullName, configuredTypes); + return null; } } Modified: trunk/Source/StructureMap/Graph/InterceptionChain.cs =================================================================== --- trunk/Source/StructureMap/Graph/InterceptionChain.cs 2008-04-07 15:00:00 UTC (rev 77) +++ trunk/Source/StructureMap/Graph/InterceptionChain.cs 2008-04-11 23:31:23 UTC (rev 78) @@ -9,7 +9,7 @@ /// Manages a list of InstanceFactoryInterceptor's. Design-time model of an array /// of decorators to alter the InstanceFactory behavior for a PluginType. /// </summary> - public class InterceptionChain : IEnumerable<InstanceFactoryInterceptor> + public class InterceptionChain : IEnumerable<InstanceFactoryInterceptor>, IEquatable<InterceptionChain> { private List<InstanceFactoryInterceptor> _interceptorList; @@ -73,5 +73,32 @@ return false; } + + public bool Equals(InterceptionChain interceptionChain) + { + if (interceptionChain == null) return false; + + + if (!Equals(_interceptorList.Count, interceptionChain._interceptorList.Count)) return false; + + for (int i = 0; i < _interceptorList.Count; i++) + { + if (!Equals(_interceptorList[i], interceptionChain._interceptorList[i])) return false; + + } + + return true; + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(this, obj)) return true; + return Equals(obj as InterceptionChain); + } + + public override int GetHashCode() + { + return _interceptorList != null ? _interceptorList.GetHashCode() : 0; + } } } \ No newline at end of file Modified: trunk/Source/StructureMap/Graph/Plugin.cs =================================================================== --- trunk/Source/StructureMap/Graph/Plugin.cs 2008-04-07 15:00:00 UTC (rev 77) +++ trunk/Source/StructureMap/Graph/Plugin.cs 2008-04-11 23:31:23 UTC (rev 78) @@ -4,6 +4,15 @@ namespace StructureMap.Graph { + public interface IPluginArgumentVisitor + { + void Primitive(string name); + void Child(string name, Type childType); + void ChildArray(string name, Type childType); + } + + + /// <summary> /// Represents a concrete class that can be built by StructureMap as an instance of the parent /// PluginFamily\x92s PluginType. The properties of a Plugin are the CLR Type of the concrete class, @@ -87,11 +96,11 @@ if (att == null) { return - new Plugin(pluggedType, TypePath.GetAssemblyQualifiedName(pluggedType), DefinitionSource.Implicit); + new Plugin(pluggedType, TypePath.GetAssemblyQualifiedName(pluggedType)); } else { - return new Plugin(pluggedType, att.ConcreteKey, DefinitionSource.Implicit); + return new Plugin(pluggedType, att.ConcreteKey); } } @@ -104,7 +113,7 @@ /// <param name="description"></param> public static Plugin CreateExplicitPlugin(Type pluggedType, string concreteKey, string description) { - return new Plugin(pluggedType, concreteKey, DefinitionSource.Explicit); + return new Plugin(pluggedType, concreteKey); } public static ConstructorInfo GetGreediestConstructor(Type pluggedType) @@ -129,10 +138,10 @@ #endregion private string _concreteKey; - private DefinitionSource _definitionSource; private Type _pluggedType; private SetterPropertyCollection _setters; + #region constructors /// <summary> /// Creates an Explicit Plugin for the pluggedType with the entered @@ -140,7 +149,7 @@ /// </summary> /// <param name="pluggedType"></param> /// <param name="concreteKey"></param> - private Plugin(Type pluggedType, string concreteKey, DefinitionSource definitionSource) : base() + private Plugin(Type pluggedType, string concreteKey) : base() { if (concreteKey == string.Empty) { @@ -149,7 +158,6 @@ _pluggedType = pluggedType; _concreteKey = concreteKey; - _definitionSource = definitionSource; _setters = new SetterPropertyCollection(this); } @@ -170,10 +178,11 @@ _setters = new SetterPropertyCollection(this); _concreteKey = concreteKey; - _definitionSource = DefinitionSource.Explicit; } + #endregion + /// <summary> /// The ConcreteKey that identifies the Plugin within a PluginFamily /// </summary> @@ -217,16 +226,6 @@ } } - /// <summary> - /// Denotes the source or the definition for this Plugin. Implicit means the - /// Plugin is defined by a [Pluggable] attribute on the PluggedType. Explicit - /// means the Plugin was defined in the StructureMap.config file. - /// </summary> - public DefinitionSource DefinitionSource - { - get { return _definitionSource; } - set { _definitionSource = value; } - } /// <summary> /// Determines if the concrete class can be autofilled. @@ -277,7 +276,7 @@ { templatedType = _pluggedType; } - Plugin templatedPlugin = new Plugin(templatedType, _concreteKey, _definitionSource); + Plugin templatedPlugin = new Plugin(templatedType, _concreteKey); templatedPlugin._setters = _setters; return templatedPlugin; @@ -369,8 +368,6 @@ if (CanBeAutoFilled) { MemoryInstanceMemento memento = new MemoryInstanceMemento(ConcreteKey, ConcreteKey); - memento.DefinitionSource = DefinitionSource.Implicit; - returnValue = memento; } @@ -423,13 +420,72 @@ throw new StructureMapException(302, typeof (T).FullName, _pluggedType.FullName); } - public void AddToSource(MementoSource source) + public void VisitArguments(IPluginArgumentVisitor visitor) { - InstanceMemento memento = CreateImplicitMemento(); - if (memento != null) + foreach (ParameterInfo parameter in GetConstructor().GetParameters()) { - source.AddExternalMemento(memento); + visitMember(parameter.ParameterType, parameter.Name, visitor); } + + foreach (SetterProperty setter in _setters) + { + visitMember(setter.Property.PropertyType, setter.Property.Name, visitor); + } } + + private static void visitMember(Type type, string name, IPluginArgumentVisitor visitor) + { + if (TypeIsPrimitive(type)) + { + visitor.Primitive(name); + } + else if (type.IsArray) + { + visitor.ChildArray(name, type.GetElementType()); + } + else + { + visitor.Child(name, type); + } + } + + public void MergeSetters(Plugin plugin) + { + foreach (SetterProperty setter in plugin.Setters) + { + if (!_setters.Contains(setter.Name)) + { + _setters.Add(setter.Name); + } + } + } + + public bool CanBePluggedIntoGenericType(Type pluginType, params Type[] templateTypes) + { + bool isValid = true; + + Type interfaceType = PluggedType.GetInterface(pluginType.Name); + if (interfaceType == null) + { + interfaceType = PluggedType.BaseType; + } + + Type[] pluginArgs = pluginType.GetGenericArguments(); + Type[] pluggableArgs = interfaceType.GetGenericArguments(); + + if (templateTypes.Length != pluginArgs.Length && + pluginArgs.Length != pluggableArgs.Length) + { + return false; + } + + for (int i = 0; i < templateTypes.Length; i++) + { + isValid &= templateTypes[i] == pluggableArgs[i] || + pluginArgs[i].IsGenericParameter && + pluggableArgs[i].IsGenericParameter; + } + return isValid; + } } } \ No newline at end of file Modified: trunk/Source/StructureMap/Graph/PluginCollection.cs =================================================================== --- trunk/Source/StructureMap/Graph/PluginCollection.cs 2008-04-07 15:00:00 UTC (rev 77) +++ trunk/Source/StructureMap/Graph/PluginCollection.cs 2008-04-11 23:31:23 UTC (rev 78) @@ -7,21 +7,16 @@ /// <summary> /// Custom collection for Plugin objects /// </summary> - public class PluginCollection : PluginGraphObjectCollection + public class PluginCollection : IEnumerable<Plugin> { private readonly PluginFamily _family; - private Dictionary<string, Plugin> _plugins = new Dictionary<string, Plugin>(); + private readonly Dictionary<string, Plugin> _plugins = new Dictionary<string, Plugin>(); - public PluginCollection(PluginFamily family) : base(null) + public PluginCollection(PluginFamily family) { _family = family; } - protected override ICollection innerCollection - { - get { return _plugins.Values; } - } - public Plugin[] All { get @@ -33,6 +28,11 @@ } } + public int Count + { + get { return _plugins.Count; } + } + /// <summary> /// Gets a Plugin by its PluggedType /// </summary> @@ -57,16 +57,6 @@ } } - public Plugin this[int index] - { - get - { - ArrayList list = new ArrayList(this); - return (Plugin) list[index]; - } - } - - /// <summary> /// Retrieves a Plugin by its ConcreteKey /// </summary> @@ -81,19 +71,14 @@ return _plugins[concreteKey] as Plugin; } - string msg = string.Format( - "Plugin *{0}* for PluginFamily *{1}* does not exist", - concreteKey, - _family.PluginTypeName); - - throw new ApplicationException(msg); + return null; } } public void Add(TypePath path, string concreteKey) { Plugin plugin = new Plugin(path, concreteKey); - Add(plugin, true); + Add(plugin); } /// <summary> @@ -105,22 +90,25 @@ public void Add(Type pluggedType, string concreteKey) { Plugin plugin = Plugin.CreateExplicitPlugin(pluggedType, concreteKey, string.Empty); - Add(plugin, true); + Add(plugin); } - public void Add(Plugin plugin, bool addInstanceOfTypeIfPossible) + public void Add(Plugin plugin) { // Reject if a duplicate ConcreteKey if (_plugins.ContainsKey(plugin.ConcreteKey)) { - // Don't duplicate + // Don't duplicate, but merge setters Plugin peer = this[plugin.ConcreteKey]; if (peer.PluggedType == plugin.PluggedType) { + peer.MergeSetters(plugin); return; } - - throw new StructureMapException(113, plugin.ConcreteKey, _family.PluginTypeName); + else + { + throw new StructureMapException(113, plugin.ConcreteKey, _family.PluginTypeName); + } } // Reject if the PluggedType cannot be upcast to the PluginType @@ -130,11 +118,6 @@ } _plugins.Add(plugin.ConcreteKey, plugin); - - if (addInstanceOfTypeIfPossible) - { - plugin.AddToSource(_family.Source); - } } /// <summary> @@ -153,23 +136,36 @@ _plugins.Remove(concreteKey); } - public void RemoveImplicitChildren() + public Plugin FindOrCreate(Type pluggedType, bool createDefaultInstanceOfType) { - foreach (Plugin plugin in this) + Plugin plugin = Plugin.CreateImplicitPlugin(pluggedType); + Add(plugin); + + return plugin; + } + + IEnumerator<Plugin> IEnumerable<Plugin>.GetEnumerator() + { + return _plugins.Values.GetEnumerator(); + } + + public IEnumerator GetEnumerator() + { + return ((IEnumerable<Plugin>) this).GetEnumerator(); + } + + public List<Plugin> FindAutoFillablePlugins() + { + List<Plugin> list = new List<Plugin>(); + foreach (Plugin plugin in _plugins.Values) { - if (plugin.DefinitionSource == DefinitionSource.Implicit) + if (plugin.CanBeAutoFilled) { - Remove(plugin.ConcreteKey); + list.Add(plugin); } } - } - public Plugin FindOrCreate(Type pluggedType, bool createDefaultInstanceOfType) - { - Plugin plugin = Plugin.CreateImplicitPlugin(pluggedType); - Add(plugin, createDefaultInstanceOfType); - - return plugin; + return list; } } } \ No newline at end of file Modified: trunk/Source/StructureMap/Graph/PluginFamily.cs =================================================================== --- trunk/Source/StructureMap/Graph/PluginFamily.cs 2008-04-07 15:00:00 UTC (rev 77) +++ trunk/Source/StructureMap/Graph/PluginFamily.cs 2008-04-11 23:31:23 UTC (rev 78) @@ -1,6 +1,9 @@ using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; using StructureMap.Interceptors; -using StructureMap.Source; +using StructureMap.Pipeline; namespace StructureMap.Graph { @@ -9,18 +12,18 @@ /// the system. A PluginFamily defines a CLR Type that StructureMap can build, and all of the possible /// Plugin\x92s implementing the CLR Type. /// </summary> - public class PluginFamily : Deployable + public class PluginFamily { #region statics + [Obsolete] public static PluginFamily CreateAutoFilledPluginFamily(Type pluginType) { Plugin plugin = Plugin.CreateAutofilledPlugin(pluginType); PluginFamily family = new PluginFamily(pluginType); - family.DefinitionSource = DefinitionSource.Implicit; - family.Plugins.Add(plugin, true); + family.Plugins.Add(plugin); family.DefaultInstanceKey = plugin.ConcreteKey; return family; @@ -29,15 +32,16 @@ #endregion public const string CONCRETE_KEY = "CONCRETE"; + private readonly List<InstanceMemento> _mementoList = new List<InstanceMemento>(); private readonly PluginCollection _plugins; private bool _canUseUnMarkedPlugins = false; private string _defaultKey = string.Empty; - private DefinitionSource _definitionSource = DefinitionSource.Implicit; private InstanceInterceptor _instanceInterceptor = new NulloInterceptor(); private InterceptionChain _interceptionChain; + private PluginGraph _parent; private Type _pluginType; private string _pluginTypeName; - private MementoSource _source; + private List<Instance> _instances = new List<Instance>(); #region constructors @@ -49,17 +53,8 @@ _plugins = new PluginCollection(this); _interceptionChain = new InterceptionChain(); - - Source = new MemoryMementoSource(); } - public PluginFamily(Type pluginType, string defaultInstanceKey, MementoSource source) - : this(pluginType, defaultInstanceKey) - { - Source = source; - _definitionSource = DefinitionSource.Explicit; - _pluginTypeName = TypePath.GetAssemblyQualifiedName(_pluginType); - } /// <summary> /// Testing constructor @@ -87,11 +82,15 @@ _pluginTypeName = path.AssemblyQualifiedName; _interceptionChain = new InterceptionChain(); initializeExplicit(path, defaultKey); + } - Source = new MemoryMementoSource(); + + public PluginGraph Parent + { + get { return _parent; } + set { _parent = value; } } - private void initializeExplicit(TypePath path, string defaultKey) { try @@ -115,14 +114,13 @@ set { _instanceInterceptor = value; } } - // This code sucks. What's going on here? + // TODO: This code sucks. What's going on here? public PluginFamily CreateTemplatedClone(params Type[] templateTypes) { Type templatedType = _pluginType.MakeGenericType(templateTypes); PluginFamily templatedFamily = new PluginFamily(templatedType); templatedFamily._defaultKey = _defaultKey; - templatedFamily._source = new MemoryMementoSource(); - templatedFamily._definitionSource = _definitionSource; + templatedFamily.Parent = Parent; foreach (InstanceFactoryInterceptor interceptor in _interceptionChain) { @@ -130,51 +128,26 @@ templatedFamily.InterceptionChain.AddInterceptor(clonedInterceptor); } + // Add Plugins foreach (Plugin plugin in _plugins) { - if (isOfCorrectGenericType(plugin, templateTypes)) + if (plugin.CanBePluggedIntoGenericType(_pluginType, templateTypes)) { Plugin templatedPlugin = plugin.CreateTemplatedClone(templateTypes); - templatedFamily.Plugins.Add(templatedPlugin, true); - foreach (InstanceMemento memento in _source.GetAllMementos()) - { - if (memento.ConcreteKey == plugin.ConcreteKey) - { - templatedFamily._source.AddExternalMemento(memento); - } - } + ... [truncated message content] |
From: <jer...@us...> - 2008-05-06 20:33:17
|
Revision: 93 http://structuremap.svn.sourceforge.net/structuremap/?rev=93&view=rev Author: jeremydmiller Date: 2008-05-06 13:33:10 -0700 (Tue, 06 May 2008) Log Message: ----------- Introducing the AssemblyScanner! Modified Paths: -------------- trunk/Source/StructureMap/Configuration/DSL/Expressions/CreatePluginFamilyExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/ScanAssembliesExpression.cs trunk/Source/StructureMap/Configuration/DSL/Registry.cs trunk/Source/StructureMap/Configuration/IGraphBuilder.cs trunk/Source/StructureMap/Configuration/NormalGraphBuilder.cs trunk/Source/StructureMap/Diagnostics/Tokens.cs trunk/Source/StructureMap/Graph/PluginCollection.cs trunk/Source/StructureMap/Graph/PluginFamily.cs trunk/Source/StructureMap/Graph/PluginGraph.cs trunk/Source/StructureMap/Pipeline/BuildStrategies.cs trunk/Source/StructureMap/PluginGraphBuilder.cs trunk/Source/StructureMap/StructureMap.csproj trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryIntegratedTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/ScanAssembliesTester.cs trunk/Source/StructureMap.Testing/Configuration/ShortcuttedInstanceNodeTester.cs trunk/Source/StructureMap.Testing/Container/ArrayConstructorTester.cs trunk/Source/StructureMap.Testing/Container/PluginGraphBuilderTester.cs trunk/Source/StructureMap.Testing/Container/TypeFindingTester.cs trunk/Source/StructureMap.Testing/Graph/PluginFamilyTester.cs trunk/Source/StructureMap.Testing/Graph/PluginTester.cs trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj trunk/StructureMap.config Added Paths: ----------- trunk/Source/StructureMap/Emitting/ConstructorEmitter.cs trunk/Source/StructureMap/Graph/AssemblyScanner.cs trunk/Source/StructureMap/Graph/IPluginFamily.cs trunk/Source/StructureMap.Testing/Configuration/NormalGraphBuilderTester.cs Removed Paths: ------------- trunk/Source/StructureMap/Graph/AssemblyGraph.cs trunk/Source/StructureMap/Graph/AssemblyGraphCollection.cs trunk/Source/StructureMap.Testing/Container/MockingTester.cs trunk/Source/StructureMap.Testing/Graph/AssemblyGraphTester.cs Modified: trunk/Source/StructureMap/Configuration/DSL/Expressions/CreatePluginFamilyExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/CreatePluginFamilyExpression.cs 2008-05-04 02:59:57 UTC (rev 92) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/CreatePluginFamilyExpression.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -4,6 +4,7 @@ using StructureMap.Graph; using StructureMap.Interceptors; using StructureMap.Pipeline; +using StructureMap.Source; namespace StructureMap.Configuration.DSL.Expressions { @@ -40,9 +41,6 @@ { alteration(family); } - - AssemblyGraph assembly = new AssemblyGraph(_pluginType.Assembly); - graph.Assemblies.Add(assembly); } #endregion @@ -169,5 +167,25 @@ }); return this; } + + public CreatePluginFamilyExpression<PLUGINTYPE> AddInstancesFrom(MementoSource source) + { + _alterations.Add(delegate(PluginFamily family) + { + family.AddMementoSource(source); + }); + + return this; + } + + public CreatePluginFamilyExpression<PLUGINTYPE> AliasConcreteType<PLUGGEDTYPE>(string concreteKey) + { + _alterations.Add(delegate(PluginFamily family) + { + family.AddPlugin(typeof(PLUGGEDTYPE), concreteKey); + }); + + return this; + } } } \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/DSL/Expressions/ScanAssembliesExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/ScanAssembliesExpression.cs 2008-05-04 02:59:57 UTC (rev 92) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/ScanAssembliesExpression.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; @@ -12,7 +13,7 @@ /// </summary> public class ScanAssembliesExpression : IExpression { - private readonly List<AssemblyGraph> _assemblies = new List<AssemblyGraph>(); + private readonly List<Assembly> _assemblies = new List<Assembly>(); private readonly Registry _registry; public ScanAssembliesExpression(Registry registry) @@ -24,7 +25,7 @@ void IExpression.Configure(PluginGraph graph) { - foreach (AssemblyGraph assembly in _assemblies) + foreach (Assembly assembly in _assemblies) { graph.Assemblies.Add(assembly); } @@ -38,7 +39,7 @@ if (callingAssembly != null) { - _assemblies.Add(new AssemblyGraph(callingAssembly)); + _assemblies.Add(callingAssembly); } return this; @@ -65,18 +66,19 @@ public ScanAssembliesExpression IncludeAssemblyContainingType<T>() { - _assemblies.Add(AssemblyGraph.ContainingType<T>()); + _assemblies.Add(typeof(T).Assembly); return this; } public ScanAssembliesExpression AddAllTypesOf<PLUGINTYPE>() { + // TODO: Do this by adding something to TypeScanner _registry.addExpression(delegate(PluginGraph pluginGraph) { PluginFamily family = pluginGraph.FindFamily(typeof (PLUGINTYPE)); - family.CanUseUnMarkedPlugins = true; + family.SearchForImplicitPlugins = true; }); return this; @@ -84,7 +86,9 @@ public ScanAssembliesExpression IncludeAssembly(string assemblyName) { - _assemblies.Add(new AssemblyGraph(assemblyName)); + Assembly assembly = AppDomain.CurrentDomain.Load(assemblyName); + _assemblies.Add(assembly); + return this; } } Modified: trunk/Source/StructureMap/Configuration/DSL/Registry.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Registry.cs 2008-05-04 02:59:57 UTC (rev 92) +++ trunk/Source/StructureMap/Configuration/DSL/Registry.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -97,6 +97,14 @@ return new InstanceManager(_graph); } + public PluginGraph Build() + { + ConfigurePluginGraph(_graph); + _graph.Seal(); + + return _graph; + } + /// <summary> /// Starts an instance definition of type T /// </summary> Modified: trunk/Source/StructureMap/Configuration/IGraphBuilder.cs =================================================================== --- trunk/Source/StructureMap/Configuration/IGraphBuilder.cs 2008-05-04 02:59:57 UTC (rev 92) +++ trunk/Source/StructureMap/Configuration/IGraphBuilder.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -20,7 +20,7 @@ PluginGraph PluginGraph { get; } void AddAssembly(string assemblyName); - void StartFamilies(); + void PrepareSystemObjects(); void FinishFamilies(); IProfileBuilder GetProfileBuilder(); Modified: trunk/Source/StructureMap/Configuration/NormalGraphBuilder.cs =================================================================== --- trunk/Source/StructureMap/Configuration/NormalGraphBuilder.cs 2008-05-04 02:59:57 UTC (rev 92) +++ trunk/Source/StructureMap/Configuration/NormalGraphBuilder.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -49,15 +49,19 @@ public void AddAssembly(string assemblyName) { - AssemblyGraph assemblyGraph = new AssemblyGraph(assemblyName); - _pluginGraph.Assemblies.Add(assemblyGraph); - - AssemblyGraph systemAssemblyGraph = new AssemblyGraph(assemblyName); - systemAssemblyGraph.LookForPluginFamilies = false; - _systemGraph.Assemblies.Add(systemAssemblyGraph); + try + { + Assembly assembly = AppDomain.CurrentDomain.Load(assemblyName); + _pluginGraph.Assemblies.Add(assembly); + _systemGraph.Assemblies.Add(assembly); + } + catch (Exception ex) + { + _pluginGraph.Log.RegisterError(101, ex, assemblyName); + } } - public void StartFamilies() + public void PrepareSystemObjects() { // TODO: is this a problem here? _systemGraph.Seal(); Modified: trunk/Source/StructureMap/Diagnostics/Tokens.cs =================================================================== --- trunk/Source/StructureMap/Diagnostics/Tokens.cs 2008-05-04 02:59:57 UTC (rev 92) +++ trunk/Source/StructureMap/Diagnostics/Tokens.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -12,6 +12,11 @@ private readonly List<Source> _sources = new List<Source>(); private Source _currentSource; + public int ErrorCount + { + get { return _errors.Count; } + } + public void StartSource(string description) { Source source = new Source(description); Added: trunk/Source/StructureMap/Emitting/ConstructorEmitter.cs =================================================================== --- trunk/Source/StructureMap/Emitting/ConstructorEmitter.cs (rev 0) +++ trunk/Source/StructureMap/Emitting/ConstructorEmitter.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Reflection.Emit; +using System.Text; +using StructureMap.Graph; +using StructureMap.Pipeline; + +namespace StructureMap.Emitting +{ + public class ConstructorEmitter : IPluginArgumentVisitor + { + private readonly ILGenerator _ilgen; + + public ConstructorEmitter(ILGenerator ilgen) + { + _ilgen = ilgen; + } + + + public void Primitive(string name) + { + throw new NotImplementedException(); + } + + public void Child(string name, Type childType) + { + throw new NotImplementedException(); + } + + public void ChildArray(string name, Type childType) + { + throw new NotImplementedException(); + } + + protected void callInstanceMemento(ILGenerator ilgen, string methodName) + { + MethodInfo _method = typeof(IConfiguredInstance).GetMethod(methodName); + ilgen.Emit(OpCodes.Callvirt, _method); + } + + protected void cast(ILGenerator ilgen, Type parameterType) + { + ilgen.Emit(OpCodes.Castclass, parameterType); + } + } +} Deleted: trunk/Source/StructureMap/Graph/AssemblyGraph.cs =================================================================== --- trunk/Source/StructureMap/Graph/AssemblyGraph.cs 2008-05-04 02:59:57 UTC (rev 92) +++ trunk/Source/StructureMap/Graph/AssemblyGraph.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -1,167 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; -using StructureMap.Configuration.DSL; - -namespace StructureMap.Graph -{ - /// <summary> - /// Models an assembly reference in a PluginGraph - /// </summary> - [Obsolete("Kill!")] - public class AssemblyGraph : IComparable - { - private readonly Assembly _assembly; - private readonly string _assemblyName; - private bool _lookForPluginFamilies = true; - - - /// <summary> - /// Creates an AssemblyGraph, traps exceptions to troubleshoot configuration issues - /// </summary> - /// <param name="assemblyName"></param> - public AssemblyGraph(string assemblyName) - { - _assemblyName = assemblyName; - - try - { - _assembly = AppDomain.CurrentDomain.Load(assemblyName); - } - catch (Exception ex) - { - // TODO: Register error with PluginGraph. Maybe do this at configuration time - throw new StructureMapException(101, ex, assemblyName); - } - } - - public AssemblyGraph(Assembly assembly) - { - _assemblyName = assembly.GetName().Name; - _assembly = assembly; - } - - /// <summary> - /// Short name of the Assembly - /// </summary> - public string AssemblyName - { - get { return _assemblyName; } - } - - - /// <summary> - /// Reference to the System.Reflection.Assembly object - /// </summary> - public Assembly InnerAssembly - { - get { return _assembly; } - } - - /// <summary> - /// Used to control whether or not the assembly should be searched for implicit attributes - /// </summary> - public bool LookForPluginFamilies - { - get { return _lookForPluginFamilies; } - set { _lookForPluginFamilies = value; } - } - - #region IComparable Members - - public int CompareTo(object obj) - { - AssemblyGraph peer = (AssemblyGraph) obj; - return AssemblyName.CompareTo(peer.AssemblyName); - } - - #endregion - - /// <summary> - /// Returns an array of all the CLR Type's in the Assembly that are marked as - /// [PluginFamily] - /// </summary> - /// <returns></returns> - // TODO: Move into the new TypeScanner - public PluginFamily[] FindPluginFamilies() - { - if (_assembly == null || !LookForPluginFamilies) - { - return new PluginFamily[0]; - } - - List<PluginFamily> list = new List<PluginFamily>(); - - Type[] exportedTypes = getExportedTypes(); - - foreach (Type exportedType in exportedTypes) - { - if (PluginFamilyAttribute.MarkedAsPluginFamily(exportedType)) - { - PluginFamily family = new PluginFamily(exportedType); - list.Add(family); - } - } - - return list.ToArray(); - } - - // TODO: Move to TypeScanner - private Type[] getExportedTypes() - { - Type[] exportedTypes; - try - { - exportedTypes = _assembly.GetExportedTypes(); - } - catch (Exception ex) - { - throw new StructureMapException(170, ex, AssemblyName); - } - return exportedTypes; - } - - - public Plugin[] FindPlugins(Predicate<Type> match) - { - Type[] types = FindTypes(match); - return Array.ConvertAll<Type, Plugin>(types, - delegate(Type type) { return Plugin.CreateImplicitPlugin(type); }); - } - - - public static AssemblyGraph ContainingType<T>() - { - return new AssemblyGraph(typeof (T).Assembly); - } - - public Type FindTypeByFullName(string fullName) - { - return _assembly.GetType(fullName, false); - } - - - // TODO: Move into the new TypeScanner - public List<Registry> FindRegistries() - { - Type[] exportedTypes = getExportedTypes(); - List<Registry> returnValue = new List<Registry>(); - - foreach (Type type in exportedTypes) - { - if (Registry.IsPublicRegistry(type)) - { - Registry registry = (Registry) Activator.CreateInstance(type); - returnValue.Add(registry); - } - } - - return returnValue; - } - - public Type[] FindTypes(Predicate<Type> match) - { - return Array.FindAll(getExportedTypes(), match); - } - } -} \ No newline at end of file Deleted: trunk/Source/StructureMap/Graph/AssemblyGraphCollection.cs =================================================================== --- trunk/Source/StructureMap/Graph/AssemblyGraphCollection.cs 2008-05-04 02:59:57 UTC (rev 92) +++ trunk/Source/StructureMap/Graph/AssemblyGraphCollection.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -1,87 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; - -namespace StructureMap.Graph -{ - /// <summary> - /// Custom collection for AssemblyGraph's - /// </summary> - [Obsolete("Kill!")] public class AssemblyGraphCollection : IEnumerable<AssemblyGraph> - { - private Dictionary<string, AssemblyGraph> _assemblies; - - public AssemblyGraphCollection(PluginGraph pluginGraph) - { - _assemblies = new Dictionary<string, AssemblyGraph>(); - } - - public AssemblyGraph this[string assemblyName] - { - get { return _assemblies[assemblyName]; } - } - - public AssemblyGraph this[int index] - { - get - { - AssemblyGraph[] array = new AssemblyGraph[_assemblies.Count]; - _assemblies.Values.CopyTo(array, 0); - return array[index]; - } - } - - public int Count - { - get { return _assemblies.Count; } - } - - public AssemblyGraph Add(string assemblyName) - { - AssemblyGraph assemblyGraph = new AssemblyGraph(assemblyName); - return Add(assemblyGraph); - } - - public AssemblyGraph Add(Assembly assembly) - { - return Add(new AssemblyGraph(assembly)); - } - - public AssemblyGraph Add(AssemblyGraph assemblyGraph) - { - if (_assemblies.ContainsKey(assemblyGraph.AssemblyName)) - { - return _assemblies[assemblyGraph.AssemblyName]; - } - - _assemblies.Add(assemblyGraph.AssemblyName, assemblyGraph); - return assemblyGraph; - } - - public void Remove(string assemblyName) - { - _assemblies.Remove(assemblyName); - } - - public void Remove(AssemblyGraph assemblyGraph) - { - Remove(assemblyGraph.AssemblyName); - } - - public bool Contains(string assemblyName) - { - return _assemblies.ContainsKey(assemblyName); - } - - IEnumerator<AssemblyGraph> IEnumerable<AssemblyGraph>.GetEnumerator() - { - return _assemblies.Values.GetEnumerator(); - } - - public IEnumerator GetEnumerator() - { - return ((IEnumerable<AssemblyGraph>) this).GetEnumerator(); - } - } -} \ No newline at end of file Added: trunk/Source/StructureMap/Graph/AssemblyScanner.cs =================================================================== --- trunk/Source/StructureMap/Graph/AssemblyScanner.cs (rev 0) +++ trunk/Source/StructureMap/Graph/AssemblyScanner.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -0,0 +1,128 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; +using StructureMap.Configuration.DSL; +using StructureMap.Diagnostics; + +namespace StructureMap.Graph +{ + // TODO: dies in 3.5 + public delegate void Action<T, U>(T t, U u); + + // TODO: redo in 3.5 w/ Lambdas + public class AssemblyScanner + { + private readonly GraphLog _log; + private readonly List<Assembly> _assemblies = new List<Assembly>(); + + public AssemblyScanner(GraphLog log) + { + _log = log; + } + + public int Count + { + get { return _assemblies.Count; } + } + + public void ScanForAll(PluginGraph pluginGraph) + { + // Don't do this for SystemScan + scanTypes(delegate(Type type) + { + if (Registry.IsPublicRegistry(type)) + { + Registry registry = (Registry)Activator.CreateInstance(type); + registry.ConfigurePluginGraph(pluginGraph); + } + }); + + + findFamiliesAndPlugins(pluginGraph); + } + + private void findFamiliesAndPlugins(PluginGraph pluginGraph) + { + scanTypes(delegate(Type type) + { + if (PluginFamilyAttribute.MarkedAsPluginFamily(type)) + { + pluginGraph.CreateFamily(type); + } + }); + + scanTypes(delegate(Type type) + { + foreach (PluginFamily family in pluginGraph.PluginFamilies) + { + family.AnalyzeTypeForPlugin(type); + } + }); + } + + + public void ScanForStructureMapObjects(PluginGraph pluginGraph) + { + findFamiliesAndPlugins(pluginGraph); + } + + private void scanTypes(Action<Type> action) + { + scanTypes(new Action<Type>[]{action}); + } + + private void scanTypes(IEnumerable<Action<Type>> actions) + { + foreach (Assembly assembly in _assemblies.ToArray()) + { + scanTypesInAssembly(assembly, actions); + } + } + + private void scanTypesInAssembly(Assembly assembly, IEnumerable<Action<Type>> actions) + { + Type[] exportedTypes; + try + { + foreach (Type type in assembly.GetExportedTypes()) + { + foreach (Action<Type> action in actions) + { + action(type); + } + } + } + catch (Exception ex) + { + _log.RegisterError(170, ex, assembly.FullName); + } + } + + public void Add(Assembly assembly) + { + if (!_assemblies.Contains(assembly)) + { + _assemblies.Add(assembly); + } + } + + public void Add(string assemblyName) + { + Add(AppDomain.CurrentDomain.Load(assemblyName)); + } + + public bool Contains(string assemblyName) + { + foreach (Assembly assembly in _assemblies) + { + if (assembly.GetName().Name == assemblyName) + { + return true; + } + } + + return false; + } + } +} Added: trunk/Source/StructureMap/Graph/IPluginFamily.cs =================================================================== --- trunk/Source/StructureMap/Graph/IPluginFamily.cs (rev 0) +++ trunk/Source/StructureMap/Graph/IPluginFamily.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -0,0 +1,32 @@ +using System; +using StructureMap.Attributes; +using StructureMap.Pipeline; + +namespace StructureMap.Graph +{ + public interface IPluginFamily + { + void AddMementoSource(MementoSource source); + + /// <summary> + /// The InstanceKey of the default instance of the PluginFamily + /// </summary> + string DefaultInstanceKey { get; set; } + + /// <summary> + /// The CLR Type that defines the "Plugin" interface for the PluginFamily + /// </summary> + Type PluginType + { + get; + } + + string PluginTypeName + { + get; + } + + void SetScopeTo(InstanceScope scope); + void AddInterceptor(IInstanceInterceptor interceptor); + } +} \ No newline at end of file Modified: trunk/Source/StructureMap/Graph/PluginCollection.cs =================================================================== --- trunk/Source/StructureMap/Graph/PluginCollection.cs 2008-05-04 02:59:57 UTC (rev 92) +++ trunk/Source/StructureMap/Graph/PluginCollection.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -167,5 +167,18 @@ return list; } + + public bool HasPlugin(Type pluggedType) + { + foreach (KeyValuePair<string, Plugin> pair in _plugins) + { + if (pair.Value.PluggedType == pluggedType) + { + return true; + } + } + + return false; + } } } \ No newline at end of file Modified: trunk/Source/StructureMap/Graph/PluginFamily.cs =================================================================== --- trunk/Source/StructureMap/Graph/PluginFamily.cs 2008-05-04 02:59:57 UTC (rev 92) +++ trunk/Source/StructureMap/Graph/PluginFamily.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -18,16 +18,19 @@ public const string CONCRETE_KEY = "CONCRETE"; private readonly List<InstanceMemento> _mementoList = new List<InstanceMemento>(); private readonly PluginCollection _plugins; - private bool _canUseUnMarkedPlugins = false; private string _defaultKey = string.Empty; private InstanceInterceptor _instanceInterceptor = new NulloInterceptor(); private PluginGraph _parent; - private Type _pluginType; - private string _pluginTypeName; - private List<Instance> _instances = new List<Instance>(); + private readonly Type _pluginType; + private readonly string _pluginTypeName; + private readonly List<Instance> _instances = new List<Instance>(); private IBuildPolicy _buildPolicy = new BuildPolicy(); + private readonly Predicate<Type> _explicitlyMarkedPluginFilter; + private readonly Predicate<Type> _implicitPluginFilter; + private Predicate<Type> _pluginFilter; + // TODO: Need to unit test the scope from the attribute /// <summary> /// Testing constructor @@ -40,6 +43,10 @@ _plugins = new PluginCollection(this); PluginFamilyAttribute.ConfigureFamily(this); + + _explicitlyMarkedPluginFilter = delegate(Type type) { return Plugin.IsAnExplicitPlugin(PluginType, type); }; + _implicitPluginFilter = delegate(Type type) { return Plugin.CanBeCast(PluginType, type); }; + _pluginFilter = _explicitlyMarkedPluginFilter; } @@ -89,32 +96,8 @@ return templatedFamily; } - // TODO: Move this into TypeScanner - /// <summary> - /// Finds Plugin's that match the PluginType from the assembly and add to the internal - /// collection of Plugin's - /// </summary> - /// <param name="assembly"></param> - [Obsolete] public Plugin[] FindPlugins(AssemblyGraph assembly) - { - Predicate<Type> pluggedTypeFilter = - delegate(Type type) { return Plugin.IsAnExplicitPlugin(PluginType, type); }; - if (_canUseUnMarkedPlugins) - { - pluggedTypeFilter = delegate(Type type) { return Plugin.CanBeCast(PluginType, type); }; - } - Plugin[] plugins = assembly.FindPlugins(pluggedTypeFilter); - - foreach (Plugin plugin in plugins) - { - _plugins.Add(plugin); - } - - return plugins; - } - public void AddInstance(InstanceMemento memento) { _mementoList.Add(memento); @@ -136,21 +119,7 @@ return _mementoList.Find(delegate(InstanceMemento m) { return m.InstanceKey == instanceKey; }); } - // TODO -- Move out into TypeScanner - public void DiscoverImplicitInstances() - { - List<Plugin> list = _plugins.FindAutoFillablePlugins(); - foreach (InstanceMemento memento in _mementoList) - { - Plugin plugin = memento.FindPlugin(this); - list.Remove(plugin); - } - foreach (Plugin plugin in list) - { - AddInstance(plugin.CreateImplicitMemento()); - } - } #region properties @@ -191,11 +160,16 @@ get { return _pluginType.IsGenericType; } } - - public bool CanUseUnMarkedPlugins + public bool SearchForImplicitPlugins { - get { return _canUseUnMarkedPlugins; } - set { _canUseUnMarkedPlugins = value; } + get + { + return ReferenceEquals(_pluginFilter, _implicitPluginFilter); + } + set + { + _pluginFilter = value ? _implicitPluginFilter : _explicitlyMarkedPluginFilter; + } } public IBuildPolicy Policy @@ -203,10 +177,17 @@ get { return _buildPolicy; } } + public int PluginCount + { + get { return _plugins.Count; } + } + #endregion public void Seal() { + discoverImplicitInstances(); + foreach (InstanceMemento memento in _mementoList) { Instance instance = memento.ReadInstance(Parent, _pluginType); @@ -214,6 +195,21 @@ } } + private void discoverImplicitInstances() + { + List<Plugin> list = _plugins.FindAutoFillablePlugins(); + foreach (InstanceMemento memento in _mementoList) + { + Plugin plugin = memento.FindPlugin(this); + list.Remove(plugin); + } + + foreach (Plugin plugin in list) + { + AddInstance(plugin.CreateImplicitMemento()); + } + } + public Instance[] GetAllInstances() { return _instances.ToArray(); @@ -253,5 +249,36 @@ } + public void AnalyzeTypeForPlugin(Type pluggedType) + { + if (_pluginFilter(pluggedType)) + { + if (!HasPlugin(pluggedType)) + { + Plugin plugin = Plugin.CreateImplicitPlugin(pluggedType); + _plugins.Add(plugin); + } + } + } + + public bool HasPlugin(Type pluggedType) + { + return _plugins.HasPlugin(pluggedType); + } + + public void AddPlugin(Type pluggedType) + { + if (!HasPlugin(pluggedType)) + { + _plugins.Add(Plugin.CreateImplicitPlugin(pluggedType)); + } + } + + public void AddPlugin(Type pluggedType, string key) + { + Plugin plugin = Plugin.CreateExplicitPlugin(pluggedType, key, string.Empty); + _plugins.Add(plugin); + + } } } \ No newline at end of file Modified: trunk/Source/StructureMap/Graph/PluginGraph.cs =================================================================== --- trunk/Source/StructureMap/Graph/PluginGraph.cs 2008-05-04 02:59:57 UTC (rev 92) +++ trunk/Source/StructureMap/Graph/PluginGraph.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -16,7 +16,7 @@ [Serializable] public class PluginGraph { - private readonly AssemblyGraphCollection _assemblies; + private readonly AssemblyScanner _assemblies; private readonly InterceptorLibrary _interceptorLibrary = new InterceptorLibrary(); private readonly GraphLog _log = new GraphLog(); private readonly PluginFamilyCollection _pluginFamilies; @@ -29,7 +29,7 @@ /// </summary> public PluginGraph() : base() { - _assemblies = new AssemblyGraphCollection(this); + _assemblies = new AssemblyScanner(_log); _pluginFamilies = new PluginFamilyCollection(this); } @@ -39,7 +39,7 @@ _useExternalRegistries = useExternalRegistries; } - public AssemblyGraphCollection Assemblies + public AssemblyScanner Assemblies { get { return _assemblies; } } @@ -89,22 +89,15 @@ if (_useExternalRegistries) { - searchAssembliesForRegistries(); + _assemblies.ScanForAll(this); } - - foreach (AssemblyGraph assembly in _assemblies) + else { - addImplicitPluginFamilies(assembly); + _assemblies.ScanForStructureMapObjects(this); } foreach (PluginFamily family in _pluginFamilies) { - attachImplicitPlugins(family); - family.DiscoverImplicitInstances(); - } - - foreach (PluginFamily family in _pluginFamilies) - { family.Seal(); } @@ -114,44 +107,7 @@ } - private void searchAssembliesForRegistries() - { - List<Registry> list = new List<Registry>(); - foreach (AssemblyGraph assembly in _assemblies) - { - list.AddRange(assembly.FindRegistries()); - } - foreach (Registry registry in list) - { - registry.ConfigurePluginGraph(this); - } - } - - private void attachImplicitPlugins(PluginFamily family) - { - foreach (AssemblyGraph assembly in _assemblies) - { - family.FindPlugins(assembly); - } - } - - - private void addImplicitPluginFamilies(AssemblyGraph assemblyGraph) - { - PluginFamily[] families = assemblyGraph.FindPluginFamilies(); - - foreach (PluginFamily family in families) - { - if (_pluginFamilies.Contains(family.PluginType)) - { - continue; - } - - _pluginFamilies.Add(family); - } - } - #endregion public static PluginGraph BuildGraphFromAssembly(Assembly assembly) @@ -171,7 +127,6 @@ { PluginFamily family = new PluginFamily(pluginType); _pluginFamilies.Add(family); - attachImplicitPlugins(family); } } @@ -185,5 +140,11 @@ { return _pluginFamilies.Contains(pluginType); } + + public void CreateFamily(Type pluginType) + { + // Just guarantee that this PluginFamily exists + FindFamily(pluginType); + } } } \ No newline at end of file Modified: trunk/Source/StructureMap/Pipeline/BuildStrategies.cs =================================================================== --- trunk/Source/StructureMap/Pipeline/BuildStrategies.cs 2008-05-04 02:59:57 UTC (rev 92) +++ trunk/Source/StructureMap/Pipeline/BuildStrategies.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -2,6 +2,7 @@ namespace StructureMap.Pipeline { + public interface IBuildPolicy { object Build(IInstanceCreator instanceCreator, Type pluginType, Instance instance); Modified: trunk/Source/StructureMap/PluginGraphBuilder.cs =================================================================== --- trunk/Source/StructureMap/PluginGraphBuilder.cs 2008-05-04 02:59:57 UTC (rev 92) +++ trunk/Source/StructureMap/PluginGraphBuilder.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -63,6 +63,9 @@ { NormalGraphBuilder graphBuilder = new NormalGraphBuilder(_registries, _graph); buildPluginGraph(graphBuilder); + + _graph.Seal(); + return _graph; } @@ -80,7 +83,7 @@ { forAllParsers(delegate(ConfigurationParser p) { p.ParseAssemblies(graphBuilder); }); - graphBuilder.StartFamilies(); + graphBuilder.PrepareSystemObjects(); forAllParsers(delegate(ConfigurationParser p) { Modified: trunk/Source/StructureMap/StructureMap.csproj =================================================================== --- trunk/Source/StructureMap/StructureMap.csproj 2008-05-04 02:59:57 UTC (rev 92) +++ trunk/Source/StructureMap/StructureMap.csproj 2008-05-06 20:33:10 UTC (rev 93) @@ -119,6 +119,7 @@ <Compile Include="Diagnostics\Tokens.cs" /> <Compile Include="Emitting\ConstructorEmitter.cs" /> <Compile Include="Graph\IPluginFamily.cs" /> + <Compile Include="Graph\AssemblyScanner.cs" /> <Compile Include="InstanceBuilderList.cs" /> <Compile Include="InstanceFamily.cs" /> <Compile Include="Pipeline\BuildStrategies.cs" /> @@ -233,12 +234,6 @@ <Compile Include="Exceptions\StructureMapException.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="Graph\AssemblyGraph.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Graph\AssemblyGraphCollection.cs"> - <SubType>Code</SubType> - </Compile> <Compile Include="Graph\GenericsPluginGraph.cs" /> <Compile Include="Graph\Plugin.cs"> <SubType>Code</SubType> Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs 2008-05-04 02:59:57 UTC (rev 92) +++ trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -203,6 +203,7 @@ using (Registry registry = new Registry(pluginGraph)) { registry.BuildInstancesOf<IGateway>(); + registry.ScanAssemblies().IncludeAssemblyContainingType<IGateway>(); } Assert.IsTrue(pluginGraph.ContainsFamily(typeof(IGateway))); Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryIntegratedTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryIntegratedTester.cs 2008-05-04 02:59:57 UTC (rev 92) +++ trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryIntegratedTester.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -57,22 +57,10 @@ [Test] - public void FindRegistries() - { - AssemblyGraph assembly = new AssemblyGraph("StructureMap.Testing.Widget5"); - List<Registry> list = assembly.FindRegistries(); - - Assert.AreEqual(3, list.Count); - Assert.Contains(new RedGreenRegistry(), list); - Assert.Contains(new YellowBlueRegistry(), list); - Assert.Contains(new BrownBlackRegistry(), list); - } - - [Test] public void FindRegistriesWithinPluginGraphSeal() { PluginGraph graph = new PluginGraph(); - graph.Assemblies.Add("StructureMap.Testing.Widget5"); + graph.Assemblies.Add(typeof(RedGreenRegistry).Assembly); graph.Seal(); List<string> colors = new List<string>(); Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/ScanAssembliesTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DSL/ScanAssembliesTester.cs 2008-05-04 02:59:57 UTC (rev 92) +++ trunk/Source/StructureMap.Testing/Configuration/DSL/ScanAssembliesTester.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -34,11 +34,10 @@ .IncludeTheCallingAssembly(); PluginGraph graph = StructureMapConfiguration.GetPluginGraph(); - AssemblyGraph assembly = AssemblyGraph.ContainingType<IGateway>(); - Assert.IsTrue(graph.Assemblies.Contains(assembly.AssemblyName)); + Assembly assembly = typeof(IGateway).Assembly; + Assert.IsTrue(graph.Assemblies.Contains(assembly.GetName().Name)); - assembly = new AssemblyGraph(Assembly.GetExecutingAssembly()); - Assert.IsTrue(graph.Assemblies.Contains(assembly.AssemblyName)); + Assert.IsTrue(graph.Assemblies.Contains(Assembly.GetExecutingAssembly().GetName().Name)); } @@ -50,11 +49,10 @@ .IncludeAssemblyContainingType<IGateway>(); PluginGraph graph = StructureMapConfiguration.GetPluginGraph(); - AssemblyGraph assembly = AssemblyGraph.ContainingType<IGateway>(); - Assert.IsTrue(graph.Assemblies.Contains(assembly.AssemblyName)); + Assembly assembly = typeof(IGateway).Assembly; + Assert.IsTrue(graph.Assemblies.Contains(assembly.GetName().Name)); - assembly = new AssemblyGraph(Assembly.GetExecutingAssembly()); - Assert.IsTrue(graph.Assemblies.Contains(assembly.AssemblyName)); + Assert.IsTrue(graph.Assemblies.Contains(Assembly.GetExecutingAssembly().GetName().Name)); } [Test] @@ -66,8 +64,8 @@ PluginGraph graph = StructureMapConfiguration.GetPluginGraph(); - AssemblyGraph assembly = AssemblyGraph.ContainingType<IGateway>(); - Assert.IsTrue(graph.Assemblies.Contains(assembly.AssemblyName)); + Assembly assembly = typeof(IGateway).Assembly; + Assert.IsTrue(graph.Assemblies.Contains(assembly.GetName().Name)); } [Test] @@ -76,8 +74,8 @@ StructureMapConfiguration.ScanAssemblies().IncludeAssemblyContainingType<IGateway>(); PluginGraph graph = StructureMapConfiguration.GetPluginGraph(); - AssemblyGraph assembly = AssemblyGraph.ContainingType<IGateway>(); - Assert.IsTrue(graph.Assemblies.Contains(assembly.AssemblyName)); + Assembly assembly = typeof(IGateway).Assembly; + Assert.IsTrue(graph.Assemblies.Contains(assembly.GetName().Name)); } [Test] @@ -86,8 +84,7 @@ StructureMapConfiguration.ScanAssemblies().IncludeTheCallingAssembly(); PluginGraph graph = StructureMapConfiguration.GetPluginGraph(); - AssemblyGraph assembly = new AssemblyGraph(Assembly.GetExecutingAssembly()); - Assert.IsTrue(graph.Assemblies.Contains(assembly.AssemblyName)); + Assert.IsTrue(graph.Assemblies.Contains(Assembly.GetExecutingAssembly().GetName().Name)); } } } \ No newline at end of file Added: trunk/Source/StructureMap.Testing/Configuration/NormalGraphBuilderTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/NormalGraphBuilderTester.cs (rev 0) +++ trunk/Source/StructureMap.Testing/Configuration/NormalGraphBuilderTester.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -0,0 +1,146 @@ +using System; +using NUnit.Framework; +using Rhino.Mocks; +using StructureMap.Configuration; +using StructureMap.Configuration.DSL; +using StructureMap.Configuration.Mementos; +using StructureMap.Graph; +using StructureMap.Pipeline; +using StructureMap.Source; +using StructureMap.Testing.Widget3; + +namespace StructureMap.Testing.Configuration +{ + [TestFixture] + public class NormalGraphBuilderTester + { + [SetUp] + public void SetUp() + { + } + + [Test] + public void Configure_a_family_that_does_not_exist_and_log_an_error_with_PluginGraph() + { + NormalGraphBuilder builder = new NormalGraphBuilder(new Registry[0]); + builder.ConfigureFamily(new TypePath("a,a"), delegate (PluginFamily f){}); + + builder.PluginGraph.Log.AssertHasError(103); + } + + [Test] + public void Do_not_call_the_action_on_ConfigureFamily_if_the_type_path_blows_up() + { + NormalGraphBuilder builder = new NormalGraphBuilder(new Registry[0]); + builder.ConfigureFamily(new TypePath("a,a"), delegate(PluginFamily f) + { + Assert.Fail("Should not be called"); + }); + + } + + [Test] + public void Call_the_action_on_configure_family_if_the_pluginType_is_found() + { + TypePath typePath = new TypePath(typeof(IGateway)); + + bool iWasCalled = false; + NormalGraphBuilder builder = new NormalGraphBuilder(new Registry[0]); + builder.ConfigureFamily(typePath, delegate(PluginFamily f) + { + Assert.AreEqual(typeof(IGateway), f.PluginType); + iWasCalled = true; + }); + + + Assert.IsTrue(iWasCalled); + } + + [Test] + public void Log_an_error_for_a_requested_system_object_if_it_cannot_be_created() + { + MemoryInstanceMemento memento = new MemoryInstanceMemento(); + NormalGraphBuilder builder = new NormalGraphBuilder(new Registry[0]); + + builder.WithSystemObject<MementoSource>(memento, "I am going to break here", delegate(MementoSource source){}); + + builder.PluginGraph.Log.AssertHasError(130); + } + + [Test] + public void Do_not_try_to_execute_the_action_when_requested_system_object_if_it_cannot_be_created() + { + MemoryInstanceMemento memento = new MemoryInstanceMemento(); + NormalGraphBuilder builder = new NormalGraphBuilder(new Registry[0]); + + builder.WithSystemObject<MementoSource>(memento, "I am going to break here", delegate(MementoSource source) + { + Assert.Fail("Wasn't supposed to be called"); + }); + + } + + [Test] + public void Create_system_object_successfully_and_call_the_requested_action() + { + + MemoryInstanceMemento memento = new MemoryInstanceMemento("Singleton", "anything"); + + bool iWasCalled = false; + + NormalGraphBuilder builder = new NormalGraphBuilder(new Registry[0]); + builder.PrepareSystemObjects(); + builder.WithSystemObject<IInstanceInterceptor>(memento, "singleton", delegate(IInstanceInterceptor policy) + { + Assert.IsInstanceOfType(typeof(SingletonPolicy), policy); + iWasCalled = true; + }); + + Assert.IsTrue(iWasCalled); + } + + [Test] + public void WithType_fails_and_logs_error_with_the_context() + { + NormalGraphBuilder builder = new NormalGraphBuilder(new Registry[0]); + builder.WithType(new TypePath("a,a"), "creating a Plugin", delegate(Type t){Assert.Fail("Should not be called");}); + + builder.PluginGraph.Log.AssertHasError(131); + } + + [Test] + public void WithType_calls_through_to_the_Action_if_the_type_can_be_found() + { + NormalGraphBuilder builder = new NormalGraphBuilder(new Registry[0]); + bool iWasCalled = true; + + builder.WithType(new TypePath(this.GetType()), "creating a Plugin", delegate(Type t) + { + iWasCalled = true; + Assert.AreEqual(this.GetType(), t); + }); + + Assert.IsTrue(iWasCalled); + } + + [Test] + public void AddAssembly_HappyPath() + { + NormalGraphBuilder builder = new NormalGraphBuilder(new Registry[0]); + string assemblyName = this.GetType().Assembly.GetName().Name; + builder.AddAssembly(assemblyName); + + Assert.IsTrue(builder.PluginGraph.Assemblies.Contains(assemblyName)); + Assert.AreEqual(0, builder.PluginGraph.Log.ErrorCount); + } + + [Test] + public void AddAssembly_SadPath() + { + NormalGraphBuilder builder = new NormalGraphBuilder(new Registry[0]); + builder.AddAssembly("something"); + + builder.PluginGraph.Log.AssertHasError(101); + } + } +} Modified: trunk/Source/StructureMap.Testing/Configuration/ShortcuttedInstanceNodeTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/ShortcuttedInstanceNodeTester.cs 2008-05-04 02:59:57 UTC (rev 92) +++ trunk/Source/StructureMap.Testing/Configuration/ShortcuttedInstanceNodeTester.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Diagnostics; using NUnit.Framework; using StructureMap.Graph; using StructureMap.Pipeline; @@ -31,6 +32,10 @@ _graph.Seal(); Instance[] instances = _graph.FindFamily(typeof (IWidget)).GetAllInstances(); + foreach (Instance instance in instances) + { + Debug.WriteLine(instance.Name + ", " + instance.GetType().FullName); + } Assert.AreEqual(4, instances.Length); } Modified: trunk/Source/StructureMap.Testing/Container/ArrayConstructorTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/ArrayConstructorTester.cs 2008-05-04 02:59:57 UTC (rev 92) +++ trunk/Source/StructureMap.Testing/Container/ArrayConstructorTester.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -1,4 +1,6 @@ using NUnit.Framework; +using StructureMap.Configuration; +using StructureMap.Configuration.DSL; using StructureMap.Graph; using StructureMap.Source; using StructureMap.Testing.TestData; @@ -22,19 +24,19 @@ [Test] public void BuildDecisionWithRules() { + + DataMother.WriteDocument("FullTesting.XML"); DataMother.WriteDocument("Array.xml"); + DataMother.WriteDocument("ObjectMother.config"); - PluginGraph graph = DataMother.GetPluginGraph("ObjectMother.config"); - + Registry registry = new Registry(); XmlMementoSource source = new XmlFileMementoSource("Array.xml", string.Empty, "Decision"); + registry.ForRequestedType<Decision>().AddInstancesFrom(source).AliasConcreteType<Decision>("Default"); - PluginFamily family = graph.FindFamily(typeof(Decision)); - family.AddMementoSource(source); + PluginGraphBuilder builder = new PluginGraphBuilder(new ConfigurationParser[]{ConfigurationParser.FromFile("ObjectMother.config")}, new Registry[]{registry}); - family.Plugins.Add(typeof (Decision), "Default"); - - graph.Seal(); + PluginGraph graph = builder.Build(); InstanceManager manager = new InstanceManager(graph); Deleted: trunk/Source/StructureMap.Testing/Container/MockingTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/MockingTester.cs 2008-05-04 02:59:57 UTC (rev 92) +++ trunk/Source/StructureMap.Testing/Container/MockingTester.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -1,29 +0,0 @@ -using System; -using NUnit.Framework; -using StructureMap.Graph; -using StructureMap.Source; -using StructureMap.Testing.Widget3; - -namespace StructureMap.Testing.Container -{ - [TestFixture] - public class MockingTester - { - #region Setup/Teardown - - [SetUp] - public void SetUp() - { - PluginGraph graph = new PluginGraph(); - graph.Assemblies.Add("StructureMap.Testing.Widget3"); - graph.PluginFamilies.Add(gatewayType, string.Empty); - graph.Seal(); - _manager = new InstanceManager(graph); - } - - #endregion - - private InstanceManager _manager; - private Type gatewayType = typeof (IGateway); - } -} \ No newline at end of file Modified: trunk/Source/StructureMap.Testing/Container/PluginGraphBuilderTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/PluginGraphBuilderTester.cs 2008-05-04 02:59:57 UTC (rev 92) +++ trunk/Source/StructureMap.Testing/Container/PluginGraphBuilderTester.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -1,6 +1,7 @@ using System.Xml; using NUnit.Framework; using StructureMap.Configuration; +using StructureMap.Configuration.DSL; using StructureMap.Graph; using StructureMap.Pipeline; using StructureMap.Testing.TestData; @@ -141,7 +142,13 @@ [Test] public void GotPluginsThatAreMarkedAsPluggable() { - PluginFamily pluginFamily = graph.FindFamily(typeof (IWidget)); + Registry registry = new Registry(); + registry.ScanAssemblies().IncludeAssemblyContainingType<IWidget>(); + registry.BuildInstancesOf<IWidget>(); + PluginGraph pluginGraph = registry.Build(); + + + PluginFamily pluginFamily = pluginGraph.FindFamily(typeof(IWidget)); Plugin plugin = pluginFamily.Plugins[typeof (ColorWidget)]; Assert.IsNotNull(plugin); } Modified: trunk/Source/StructureMap.Testing/Container/TypeFindingTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/TypeFindingTester.cs 2008-05-04 02:59:57 UTC (rev 92) +++ trunk/Source/StructureMap.Testing/Container/TypeFindingTester.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -36,16 +36,6 @@ [Test] - public void FindTypes() - { - AssemblyGraph assemblyGraph = new AssemblyGraph(Assembly.GetExecutingAssembly()); - Type[] types = assemblyGraph.FindTypes( - delegate(Type type) { return type.Equals(typeof (BlueType)); }); - - Assert.AreEqual(new Type[] {typeof (BlueType)}, types); - } - - [Test] public void FoundTheRightNumberOfInstancesForATypeWithNoPlugins() { Assert.AreEqual(3, _manager.GetAllInstances<TypeIWantToFind>().Count); Deleted: trunk/Source/StructureMap.Testing/Graph/AssemblyGraphTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Graph/AssemblyGraphTester.cs 2008-05-04 02:59:57 UTC (rev 92) +++ trunk/Source/StructureMap.Testing/Graph/AssemblyGraphTester.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -1,68 +0,0 @@ -using System; -using System.Collections; -using NUnit.Framework; -using StructureMap.Graph; -using StructureMap.Testing.Widget; - -namespace StructureMap.Testing.Graph -{ - [TestFixture] - public class AssemblyGraphTester - { - [Test] - public void CanFindAssembly() - { - AssemblyGraph graph = new AssemblyGraph("StructureMap.Testing.Widget"); - Assert.AreEqual("StructureMap.Testing.Widget", graph.AssemblyName); - } - - - [Test] - public void CanFindFamilies() - { - AssemblyGraph graph = new AssemblyGraph("StructureMap.Testing.Widget"); - PluginFamily[] families = graph.FindPluginFamilies(); - - Assert.IsNotNull(families); - Assert.AreEqual(4, families.Length); - } - - [Test] - public void CanFindPlugins() - { - AssemblyGraph graph = new AssemblyGraph("StructureMap.Testing.Widget"); - PluginFamily family = new PluginFamily(typeof (IWidget)); - Plugin[] plugins = family.FindPlugins(graph); - Assert.IsNotNull(plugins); - Assert.AreEqual(4, plugins.Length); - } - - [Test, - ExpectedException(typeof (StructureMapException), - ExpectedMessage = "StructureMap Exception Code: 101\nAssembly DoesNotExist referenced by an <Assembly> node in StructureMap.config cannot be loaded into the current AppDomain" - )] - public void CannotFindAssembly() - { - AssemblyGraph graph = new AssemblyGraph("DoesNotExist"); - } - - [Test] - public void FindTypeByFullNameReturnsNullIfTypeNotFound() - { - AssemblyGraph assemblyGraph = new AssemblyGraph("StructureMap.Testing.Widget"); - Assert.IsNull(assemblyGraph.FindTypeByFullName("something that does not exist")); - } - - [Test] - public void FindTypeByFullNameSuccess() - { - AssemblyGraph assemblyGraph = new AssemblyGraph("StructureMap.Testing.Widget"); - Type type = typeof (IWidget); - - Type actualType = assemblyGraph.FindTypeByFullName(type.FullName); - - Assert.AreEqual(type, actualType); - } - - } -} \ No newline at end of file Modified: trunk/Source/StructureMap.Testing/Graph/PluginFamilyTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Graph/PluginFamilyTester.cs 2008-05-04 02:59:57 UTC (rev 92) +++ trunk/Source/StructureMap.Testing/Graph/PluginFamilyTester.cs 2008-05-06 20:33:10 UTC (rev 93) @@ -32,22 +32,7 @@ } - [Test] - public void GetPlugins() - { - PluginFamily family = new PluginFamily(typeof(IWidget)); - family.DefaultInstanceKey = "DefaultKey"; - AssemblyGraph graph = new AssemblyGraph("StructureMap.Testing.Widget"); - family.FindPlugins(graph); - - Assert.AreEqual(4, family.Plugins.Count, "Plugin Count"); - foreach (Plugin plugin in family.Plugins) - { - Assert.IsNotNull(plugin); - } - } - [Test] public void HasANulloInterceptorUponConstruction() { @@ -134,6 +119,72 @@ Assert.IsInstanceOfType(typeof(HybridBuildPolicy), family.Policy); } + + [Test] + public void Analyze_a_type_for_a_plugin_that_does_not_match() + { + PluginFamily family = new PluginFamily(typeof(ISingletonRepository)); + family.AnalyzeTypeForPlugin(typeof (RandomClass)); + + Assert.AreEqual(0, family.PluginCount); + } + + [Test] + public void PluginFamily_only_looks_for_explicit_plugins_by_default() + { + PluginFamily family = new PluginFamily(typeof(ISingletonRepository)); + Assert.IsFalse(family.SearchForImplicitPlugins); + } + + [Test] + public void PluginFamily_adds_an_explicitly_marked_Plugin_when_only_looking_for_Explicit_plugins() + { + PluginFamily family = new PluginFamily(typeof(ISingletonRepository)); + family.SearchForImplicitPlugins = false; + family.AnalyzeTypeForPlugin(typeof(SingletonRepositoryWithAttribute)); + + Assert.AreEqual(1, family.PluginCount); + Assert.IsTrue(family.HasPlugin(typeof(SingletonReposi... [truncated message content] |
From: <jer...@us...> - 2008-06-19 03:10:36
|
Revision: 124 http://structuremap.svn.sourceforge.net/structuremap/?rev=124&view=rev Author: jeremydmiller Date: 2008-06-18 20:10:34 -0700 (Wed, 18 Jun 2008) Log Message: ----------- updated NAnt Modified Paths: -------------- trunk/Source/StructureMap/Container.cs trunk/Source/StructureMap/Diagnostics/GraphLog.cs trunk/Source/StructureMap/Diagnostics/ValidationBuildSession.cs trunk/Source/StructureMap/Diagnostics/WhatDoIHaveWriter.cs trunk/Source/StructureMap/IContainer.cs trunk/Source/StructureMap/ObjectFactory.cs trunk/Source/StructureMap/Pipeline/Instance.cs trunk/Source/StructureMap/PipelineGraph.cs trunk/bin/Rhino.Mocks.dll trunk/bin/nant/NAnt.CompressionTasks.dll trunk/bin/nant/NAnt.CompressionTasks.xml trunk/bin/nant/NAnt.Core.dll trunk/bin/nant/NAnt.Core.xml trunk/bin/nant/NAnt.DotNetTasks.dll trunk/bin/nant/NAnt.DotNetTasks.xml trunk/bin/nant/NAnt.MSNetTasks.dll trunk/bin/nant/NAnt.MSNetTasks.xml trunk/bin/nant/NAnt.NUnit.dll trunk/bin/nant/NAnt.NUnit1Tasks.dll trunk/bin/nant/NAnt.NUnit2Tasks.dll trunk/bin/nant/NAnt.NUnit2Tasks.xml trunk/bin/nant/NAnt.SourceControlTasks.dll trunk/bin/nant/NAnt.SourceControlTasks.xml trunk/bin/nant/NAnt.VSNetTasks.dll trunk/bin/nant/NAnt.VSNetTasks.xml trunk/bin/nant/NAnt.VisualCppTasks.dll trunk/bin/nant/NAnt.VisualCppTasks.xml trunk/bin/nant/NAnt.Win32Tasks.dll trunk/bin/nant/NAnt.Win32Tasks.xml trunk/bin/nant/NAnt.exe trunk/bin/nant/NAnt.exe.config trunk/bin/nant/NAnt.xml trunk/bin/nant/NDoc.Documenter.NAnt.dll trunk/bin/nant/lib/mono/1.0/nunit.core.dll trunk/bin/nant/lib/mono/1.0/nunit.framework.dll trunk/bin/nant/lib/mono/1.0/nunit.util.dll trunk/bin/nant/lib/mono/2.0/nunit.core.dll trunk/bin/nant/lib/mono/2.0/nunit.framework.dll trunk/bin/nant/lib/mono/2.0/nunit.util.dll trunk/bin/nant/lib/net/1.0/nunit.core.dll trunk/bin/nant/lib/net/1.0/nunit.framework.dll trunk/bin/nant/lib/net/1.0/nunit.util.dll trunk/bin/nant/lib/net/1.1/nunit.core.dll trunk/bin/nant/lib/net/1.1/nunit.framework.dll trunk/bin/nant/lib/net/1.1/nunit.util.dll trunk/bin/nant/lib/net/2.0/nunit.core.dll trunk/bin/nant/lib/net/2.0/nunit.framework.dll trunk/bin/nant/lib/net/2.0/nunit.util.dll trunk/bin/nant/log4net.dll trunk/bin/nant/scvs.exe Added Paths: ----------- trunk/bin/nant/extensions/ trunk/bin/nant/extensions/common/ trunk/bin/nant/extensions/common/2.0/ trunk/bin/nant/extensions/common/2.0/NAnt.MSBuild.dll trunk/bin/nant/extensions/common/2.0/NAnt.MSBuild.xml trunk/bin/nant/lib/common/ trunk/bin/nant/lib/common/neutral/ trunk/bin/nant/lib/common/neutral/ICSharpCode.SharpCvsLib.Console.dll trunk/bin/nant/lib/common/neutral/ICSharpCode.SharpCvsLib.dll trunk/bin/nant/lib/common/neutral/ICSharpCode.SharpZipLib.dll trunk/bin/nant/lib/common/neutral/NUnitCore.dll Modified: trunk/Source/StructureMap/Container.cs =================================================================== --- trunk/Source/StructureMap/Container.cs 2008-06-16 02:12:53 UTC (rev 123) +++ trunk/Source/StructureMap/Container.cs 2008-06-19 03:10:34 UTC (rev 124) @@ -5,6 +5,7 @@ using System.Text; using StructureMap.Configuration.DSL; using StructureMap.Diagnostics; +using StructureMap.Exceptions; using StructureMap.Graph; using StructureMap.Interceptors; using StructureMap.Pipeline; @@ -280,6 +281,17 @@ return new ExplicitArgsExpression(this).With(argName); } + public void AssertConfigurationIsValid() + { + ValidationBuildSession session = new ValidationBuildSession(_pipelineGraph, _interceptorLibrary); + session.PerformValidations(); + + if (!session.Success) + { + throw new StructureMapConfigurationException(session.BuildErrorMessages()); + } + } + #endregion private IBuildSession withNewSession() Modified: trunk/Source/StructureMap/Diagnostics/GraphLog.cs =================================================================== --- trunk/Source/StructureMap/Diagnostics/GraphLog.cs 2008-06-16 02:12:53 UTC (rev 123) +++ trunk/Source/StructureMap/Diagnostics/GraphLog.cs 2008-06-19 03:10:34 UTC (rev 124) @@ -1,4 +1,5 @@ using System; +using System.Collections; using System.Collections.Generic; using System.IO; using System.Text; @@ -12,15 +13,22 @@ { private string _currentSource; private readonly List<Error> _errors = new List<Error>(); + private List<string> _sources = new List<string>(); public int ErrorCount { get { return _errors.Count; } } + public string[] Sources + { + get { return _sources.ToArray(); } + } + public void StartSource(string description) { _currentSource = description; + _sources.Add(description); } public void RegisterError(IDiagnosticInstance instance, int code, params object[] args) Modified: trunk/Source/StructureMap/Diagnostics/ValidationBuildSession.cs =================================================================== --- trunk/Source/StructureMap/Diagnostics/ValidationBuildSession.cs 2008-06-16 02:12:53 UTC (rev 123) +++ trunk/Source/StructureMap/Diagnostics/ValidationBuildSession.cs 2008-06-19 03:10:34 UTC (rev 124) @@ -107,6 +107,11 @@ } } + public void Source(string source) + { + throw new NotImplementedException(); + } + private void validate(Type pluginType, Instance instance, object builtObject) { MethodInfo[] methods = ValidationMethodAttribute.GetValidationMethods(builtObject.GetType()); Modified: trunk/Source/StructureMap/Diagnostics/WhatDoIHaveWriter.cs =================================================================== --- trunk/Source/StructureMap/Diagnostics/WhatDoIHaveWriter.cs 2008-06-16 02:12:53 UTC (rev 123) +++ trunk/Source/StructureMap/Diagnostics/WhatDoIHaveWriter.cs 2008-06-19 03:10:34 UTC (rev 124) @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Text; using StructureMap.Graph; using StructureMap.Pipeline; @@ -20,19 +21,46 @@ public string GetText() { + StringBuilder sb = new StringBuilder(); + StringWriter writer = new StringWriter(sb); + + writeSources(writer); + writeContentsOfPluginTypes(writer); + + return sb.ToString(); + } + + private void writeContentsOfPluginTypes(StringWriter stringWriter) + { _writer = new TextReportWriter(3); _instances = new List<Instance>(); _writer.AddDivider('='); - _writer.AddText("PluginType", "Name", "Description"); + _writer.AddText("PluginType", "Name", "Description"); _graph.Visit(this); _writer.AddDivider('='); - return _writer.Write(); + _writer.Write(stringWriter); } + private void writeSources(StringWriter writer) + { + writer.WriteLine("==========================================================================================================="); + writer.WriteLine("Configuration Sources:"); + writer.WriteLine(); + + for (int i = 0; i < _graph.Log.Sources.Length; i++) + { + var source = _graph.Log.Sources[i]; + string message = (i.ToString() + ")").PadRight(5) + source; + writer.WriteLine(message); + } + + writer.WriteLine(); + } + void IPipelineGraphVisitor.PluginType(Type pluginType, Instance defaultInstance) { _writer.AddDivider('-'); @@ -68,5 +96,6 @@ _writer.AddText(contents); } + } } Modified: trunk/Source/StructureMap/IContainer.cs =================================================================== --- trunk/Source/StructureMap/IContainer.cs 2008-06-16 02:12:53 UTC (rev 123) +++ trunk/Source/StructureMap/IContainer.cs 2008-06-19 03:10:34 UTC (rev 124) @@ -66,5 +66,6 @@ ExplicitArgsExpression With<T>(T arg); IExplicitProperty With(string argName); + void AssertConfigurationIsValid(); } } \ No newline at end of file Modified: trunk/Source/StructureMap/ObjectFactory.cs =================================================================== --- trunk/Source/StructureMap/ObjectFactory.cs 2008-06-16 02:12:53 UTC (rev 123) +++ trunk/Source/StructureMap/ObjectFactory.cs 2008-06-19 03:10:34 UTC (rev 124) @@ -339,7 +339,10 @@ return manager.With(argName); } - + public static void AssertConfigurationIsValid() + { + manager.AssertConfigurationIsValid(); + } } Modified: trunk/Source/StructureMap/Pipeline/Instance.cs =================================================================== --- trunk/Source/StructureMap/Pipeline/Instance.cs 2008-06-16 02:12:53 UTC (rev 123) +++ trunk/Source/StructureMap/Pipeline/Instance.cs 2008-06-19 03:10:34 UTC (rev 124) @@ -1,4 +1,6 @@ using System; +using System.Collections.Generic; +using StructureMap.Configuration.DSL; using StructureMap.Diagnostics; using StructureMap.Graph; using StructureMap.Interceptors; @@ -164,4 +166,5 @@ return thisInstance; } } + } \ No newline at end of file Modified: trunk/Source/StructureMap/PipelineGraph.cs =================================================================== --- trunk/Source/StructureMap/PipelineGraph.cs 2008-06-16 02:12:53 UTC (rev 123) +++ trunk/Source/StructureMap/PipelineGraph.cs 2008-06-19 03:10:34 UTC (rev 124) @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using StructureMap.Diagnostics; using StructureMap.Graph; using StructureMap.Pipeline; @@ -24,9 +25,12 @@ private MissingFactoryFunction _missingFactory = (pluginType, profileManager) => null; + private GraphLog _log; + public PipelineGraph(PluginGraph graph) { _profileManager = graph.ProfileManager; + _log = graph.Log; foreach (PluginFamily family in graph.PluginFamilies) { @@ -42,6 +46,11 @@ } } + public GraphLog Log + { + get { return _log; } + } + public void ImportFrom(PluginGraph graph) { foreach (PluginFamily family in graph.PluginFamilies) @@ -80,6 +89,8 @@ visitor.PluginType(pluginType, defaultInstance); pair.Value.ForEachInstance(instance => visitor.Instance(pluginType, instance)); } + + } // Useful for the validation logic Modified: trunk/bin/Rhino.Mocks.dll =================================================================== (Binary files differ) Modified: trunk/bin/nant/NAnt.CompressionTasks.dll =================================================================== (Binary files differ) Modified: trunk/bin/nant/NAnt.CompressionTasks.xml =================================================================== --- trunk/bin/nant/NAnt.CompressionTasks.xml 2008-06-16 02:12:53 UTC (rev 123) +++ trunk/bin/nant/NAnt.CompressionTasks.xml 2008-06-19 03:10:34 UTC (rev 124) @@ -109,7 +109,10 @@ Extracts files from a zip file. </summary> <remarks> - <para>Uses <see href="http://www.icsharpcode.net/OpenSource/SharpZipLib/">#ziplib</see> (SharpZipLib), an open source Zip/GZip library written entirely in C#.</para> + <para> + Uses <see href="http://www.icsharpcode.net/OpenSource/SharpZipLib/">#ziplib</see> + (SharpZipLib), an open source Zip/GZip library written entirely in C#. + </para> </remarks> <example> <para>Extracts all the file from the zip, preserving the directory structure.</para> @@ -125,13 +128,14 @@ Extracts the files from the zip file. </summary> </member> - <member name="M:NAnt.Compression.Tasks.UnZipTask.ExtractFile(System.IO.Stream,System.String,System.DateTime)"> + <member name="M:NAnt.Compression.Tasks.UnZipTask.ExtractFile(System.IO.Stream,System.String,System.DateTime,System.Int64)"> <summary> Extracts a file entry from the specified stream. </summary> <param name="inputStream">The <see cref="T:System.IO.Stream"/> containing the compressed entry.</param> <param name="entryName">The name of the entry including directory information.</param> <param name="entryDate">The date of the entry.</param> + <param name="entrySize">The uncompressed size of the entry.</param> <exception cref="T:NAnt.Core.BuildException"> <para>The destination directory for the entry could not be created.</para> <para>-or-</para> @@ -171,12 +175,21 @@ entries in the archive. The default is <see langword="true" />. </summary> </member> + <member name="P:NAnt.Compression.Tasks.UnZipTask.Encoding"> + <summary> + The character encoding that has been used for filenames inside the + zip file. The default is the system's OEM code page. + </summary> + </member> <member name="T:NAnt.Compression.Tasks.ZipTask"> <summary> Creates a zip file from the specified filesets. </summary> <remarks> - <para>Uses <see href="http://www.icsharpcode.net/OpenSource/SharpZipLib/">#ziplib</see> (SharpZipLib), an open source Tar/Zip/GZip library written entirely in C#.</para> + <para> + Uses <see href="http://www.icsharpcode.net/OpenSource/SharpZipLib/">#ziplib</see> + (SharpZipLib), an open source Tar/Zip/GZip library written entirely in C#. + </para> </remarks> <example> <para> @@ -234,6 +247,38 @@ The set of files to be included in the archive. </summary> </member> + <member name="P:NAnt.Compression.Tasks.ZipTask.DuplicateHandling"> + <summary> + Specifies the behaviour when a duplicate file is found. The default + is <see cref="F:NAnt.Compression.Types.DuplicateHandling.Add"/>. + </summary> + </member> + <member name="P:NAnt.Compression.Tasks.ZipTask.Encoding"> + <summary> + The character encoding to use for filenames and comment inside the + zip file. The default is the system's OEM code page. + </summary> + </member> + <member name="T:NAnt.Compression.Types.DuplicateHandling"> + <summary> + Specifies how entries with the same name should be processed. + </summary> + </member> + <member name="F:NAnt.Compression.Types.DuplicateHandling.Add"> + <summary> + Overwrite existing entry with same name. + </summary> + </member> + <member name="F:NAnt.Compression.Types.DuplicateHandling.Preserve"> + <summary> + Preserve existing entry with the same name. + </summary> + </member> + <member name="F:NAnt.Compression.Types.DuplicateHandling.Fail"> + <summary> + Report failure when two entries have the same name. + </summary> + </member> <member name="T:NAnt.Compression.Types.TarFileSet"> <summary> A <see cref="T:NAnt.Compression.Types.TarFileSet"/> is a <see cref="T:NAnt.Core.Types.FileSet"/> with extra Modified: trunk/bin/nant/NAnt.Core.dll =================================================================== (Binary files differ) Modified: trunk/bin/nant/NAnt.Core.xml =================================================================== --- trunk/bin/nant/NAnt.Core.xml 2008-06-16 02:12:53 UTC (rev 123) +++ trunk/bin/nant/NAnt.Core.xml 2008-06-19 03:10:34 UTC (rev 124) @@ -161,10 +161,6 @@ </summary> <remarks> <para> - Should only be applied to properties exposing strongly typed arrays or - strongly typed collections. - </para> - <para> The XML format is like this: <code> <![CDATA[ @@ -562,6 +558,19 @@ <summary> Indicates the location that a task executable can be located in. </summary> + <remarks> + <para> + When applied to a task deriving from <see cref="T:NAnt.Core.Tasks.ExternalProgramBase"/>, + the program to execute will first be searched for in the designated + location. + </para> + <para> + If the program does not exist in that location, and the file name is + not an absolute path then the list of tool paths of the current + target framework will be searched (in the order in which they are + defined in the NAnt configuration file). + </para> + </remarks> </member> <member name="M:NAnt.Core.Attributes.ProgramLocationAttribute.#ctor(NAnt.Core.Attributes.LocationType)"> <summary> @@ -651,7 +660,7 @@ </code> NOTE: Attribute values must be of type of string if you want to be able to have macros. The field stores the exact value during - InitializeTask. Just before ExecuteTask is called NAnt will expand + Initialize. Just before ExecuteTask is called NAnt will expand all the macros with the current values. </example> </member> @@ -683,17 +692,13 @@ <exception cref="T:System.ArgumentNullException"><paramref name="name"/> is <see langword="null"/>.</exception> <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="name"/> is a zero-length <see cref="T:System.String"/>.</exception> </member> - <member name="T:NAnt.Core.Filters.ChainableReader"> + <member name="T:NAnt.Core.Configuration.DirList"> <summary> - Functions as a chainable TextReader + Represents an explicitly named list of directories. </summary> <remarks> - Implements a abstraction over a TextReader that allows the class to represent - either a TextReader or another ChainableReader to which it is chained. - - By passing a ChainableReader as a constructor paramater it is possiable to - chain many ChainableReaders together. The last ChainableReader in the chain must - be based on a TextReader. + A <see cref="T:NAnt.Core.Configuration.DirList"/> is useful when you want to capture a list of + directories regardless whether they currently exist. </remarks> </member> <member name="T:NAnt.Core.Element"> @@ -725,7 +730,7 @@ </summary> <remarks> Derived classes that wish to add custom initialization should override - the <see cref="M:NAnt.Core.Element.InitializeElement(System.Xml.XmlNode)"/> method. + the <see cref="M:NAnt.Core.Element.Initialize"/> method. </remarks> </member> <member name="M:NAnt.Core.Element.Log(NAnt.Core.Level,System.String)"> @@ -756,6 +761,16 @@ </summary> <param name="elementNode">The XML node of the element to use for initialization.</param> </member> + <member name="M:NAnt.Core.Element.Initialize"> + <summary> + Derived classes should override to this method to provide extra + initialization and validation not covered by the base class. + </summary> + <remarks> + Access to the <see cref="P:NAnt.Core.Element.XmlNode"/> that was used to initialize + this <see cref="T:NAnt.Core.Element"/> is available through <see cref="P:NAnt.Core.Element.XmlNode"/>. + </remarks> + </member> <member name="M:NAnt.Core.Element.CopyTo(NAnt.Core.Element)"> <summary> Copies all instance data of the <see cref="T:NAnt.Core.Element"/> to a given @@ -998,6 +1013,116 @@ Internal interface used for setting element attributes. </summary> </member> + <member name="P:NAnt.Core.Configuration.DirList.Directory"> + <summary> + The base of the directory of this dirlist. The default is the project + base directory. + </summary> + </member> + <member name="P:NAnt.Core.Configuration.ManagedExecutionMode.Environment"> + <summary> + Gets the collection of environment variables that should be passed + to external programs that are launched. + </summary> + <value> + <summary> + The collection of environment variables that should be passed + to external programs that are launched. + </summary> + </value> + </member> + <member name="P:NAnt.Core.Configuration.RuntimeEngine.Arguments"> + <summary> + The command-line arguments for the runtime engine. + </summary> + </member> + <member name="T:NAnt.Core.Extensibility.ExtensionAssembly"> + <summary> + Represents an <see cref="P:NAnt.Core.Extensibility.ExtensionAssembly.Assembly"/> in which one or more extensions + are found. + </summary> + </member> + <member name="M:NAnt.Core.Extensibility.ExtensionAssembly.#ctor(System.Reflection.Assembly)"> + <summary> + Initializes a new instance of the <see cref="T:NAnt.Core.Extensibility.ExtensionAssembly"/> + class for a given <see cref="P:NAnt.Core.Extensibility.ExtensionAssembly.Assembly"/>. + </summary> + <param name="assembly">The <see cref="P:NAnt.Core.Extensibility.ExtensionAssembly.Assembly"/> for which to construct an <see cref="T:NAnt.Core.Extensibility.ExtensionAssembly"/>.</param> + </member> + <member name="P:NAnt.Core.Extensibility.ExtensionAssembly.Assembly"> + <summary> + Gets the <see cref="P:NAnt.Core.Extensibility.ExtensionAssembly.Assembly"/> containing extensions. + </summary> + </member> + <member name="M:NAnt.Core.Extensibility.ExtensionBuilder.#ctor(NAnt.Core.Extensibility.ExtensionAssembly)"> + <summary> + Initializes a instance of the <see cref="T:NAnt.Core.Extensibility.ExtensionBuilder"/> + class for an extension in a given <see cref="P:NAnt.Core.Extensibility.ExtensionBuilder.ExtensionAssembly"/>. + </summary> + <param name="extensionAssembly">The <see cref="P:NAnt.Core.Extensibility.ExtensionBuilder.ExtensionAssembly"/> in which the extension is found.</param> + <exception cref="T:System.ArgumentNullException"><paramref name="extensionAssembly"/> is <see langword="null"/>.</exception> + </member> + <member name="P:NAnt.Core.Extensibility.ExtensionBuilder.ExtensionAssembly"> + <summary> + Gets the <see cref="P:NAnt.Core.Extensibility.ExtensionBuilder.ExtensionAssembly"/> in which the extension + was found. + </summary> + </member> + <member name="P:NAnt.Core.Extensibility.ExtensionBuilder.Assembly"> + <summary> + Gets the <see cref="P:NAnt.Core.Extensibility.ExtensionBuilder.Assembly"/> from which the extension will + be created. + </summary> + <value> + The <see cref="P:NAnt.Core.Extensibility.ExtensionBuilder.Assembly"/> containing the extension. + </value> + </member> + <member name="M:NAnt.Core.Extensibility.PluginConsumerAttribute.#ctor(System.Type)"> + <summary> + Initializes a new instance of the <see cref="T:NAnt.Core.Extensibility.PluginConsumerAttribute"/> + with the specified type. + </summary> + <param name="type">The type of the <see cref="T:NAnt.Core.Extensibility.IPlugin"/> to consume.</param> + <exception cref="T:System.ArgumentNullException"><paramref name="type"/> is <see langword="null"/>.</exception> + </member> + <member name="T:NAnt.Core.Extensibility.PluginScanner"> + <summary> + Responsible for scanning types for plugins, and maintaining a cache of + <see cref="T:NAnt.Core.Extensibility.PluginBuilder"/> instances. + </summary> + </member> + <member name="M:NAnt.Core.Extensibility.PluginScanner.ScanTypeForPlugins(NAnt.Core.Extensibility.ExtensionAssembly,System.Type,NAnt.Core.Task)"> + <summary> + Scans a given <see cref="T:System.Type"/> for plugins. + </summary> + <param name="extensionAssembly">The <see cref="T:NAnt.Core.Extensibility.ExtensionAssembly"/> containing the <see cref="T:System.Type"/> to scan.</param> + <param name="type">The <see cref="T:System.Type"/> to scan.</param> + <param name="task">The <see cref="T:NAnt.Core.Task"/> which will be used to output messages to the build log.</param> + <returns> + <see langword="true"/> if <paramref name="type"/> represents a + <see cref="T:NAnt.Core.Extensibility.IPlugin"/>; otherwise, <see langword="false"/>. + </returns> + </member> + <member name="M:NAnt.Core.Extensibility.PluginScanner.RegisterPlugins(NAnt.Core.Extensibility.IPluginConsumer)"> + <summary> + Registers matching plugins for the specified <see cref="T:NAnt.Core.Extensibility.IPluginConsumer"/>. + </summary> + <param name="consumer">The <see cref="T:NAnt.Core.Extensibility.IPluginConsumer"/> which plugins must be registered for.</param> + <exception cref="T:System.ArgumentNullException"><paramref name="consumer"/> is <see langword="null"/>.</exception> + </member> + <member name="T:NAnt.Core.Filters.ChainableReader"> + <summary> + Functions as a chainable TextReader + </summary> + <remarks> + Implements a abstraction over a TextReader that allows the class to represent + either a TextReader or another ChainableReader to which it is chained. + + By passing a ChainableReader as a constructor paramater it is possiable to + chain many ChainableReaders together. The last ChainableReader in the chain must + be based on a TextReader. + </remarks> + </member> <member name="M:NAnt.Core.Filters.ChainableReader.Chain(NAnt.Core.Filters.ChainableReader)"> <summary> Makes it so all calls to Read and Peek are passed the ChainableReader @@ -1070,21 +1195,35 @@ is <see langword="false"/>. </summary> </member> - <member name="M:NAnt.Core.Filters.FilterBuilder.#ctor(System.String)"> + <member name="M:NAnt.Core.Filters.FilterBuilder.#ctor(NAnt.Core.Extensibility.ExtensionAssembly,System.String)"> <summary> Creates a new instance of the <see cref="T:NAnt.Core.Filters.FilterBuilder"/> class - for the specified Element class. + for the specified <see cref="T:NAnt.Core.Filters.Filter"/> class in the specified + <see cref="T:NAnt.Core.Extensibility.ExtensionAssembly"/>. </summary> - <param name="className">The class representing the Element.</param> + <param name="extensionAssembly">The <see cref="T:NAnt.Core.Extensibility.ExtensionAssembly"/> containing the <see cref="T:NAnt.Core.Filters.Filter"/>.</param> + <param name="className">The class representing the <see cref="T:NAnt.Core.Filters.Filter"/>.</param> </member> - <member name="M:NAnt.Core.Filters.FilterBuilder.#ctor(System.String,System.String)"> + <member name="P:NAnt.Core.Filters.FilterBuilder.ClassName"> <summary> - Creates a new instance of the <see cref="T:NAnt.Core.Filters.FilterBuilder"/> class - for the specified Element class in the assembly specified. + Gets the name of the <see cref="T:NAnt.Core.Filters.Filter"/> class that can be created + using this <see cref="T:NAnt.Core.Filters.FilterBuilder"/>. </summary> - <param name="className">The class representing the Element.</param> - <param name="assemblyFileName">The assembly containing the Element.</param>/// + <value> + The name of the <see cref="T:NAnt.Core.Filters.Filter"/> class that can be created using + this <see cref="T:NAnt.Core.Filters.FilterBuilder"/>. + </value> </member> + <member name="P:NAnt.Core.Filters.FilterBuilder.FilterName"> + <summary> + Gets the name of the filter which the <see cref="T:NAnt.Core.Filters.FilterBuilder"/> + can create. + </summary> + <value> + The name of the task which the <see cref="T:NAnt.Core.TaskBuilder"/> can + create. + </value> + </member> <member name="T:NAnt.Core.Filters.FilterBuilderCollection"> <summary> Contains a strongly typed collection of <see cref="T:NAnt.Core.Filters.FilterBuilder"/> objects. @@ -1307,13 +1446,13 @@ </summary> </member> <member name="P:NAnt.Core.DataTypeBase.ID"> - <summary> - The ID used to be referenced later. + <summary> + The ID used to be referenced later. </summary> </member> <member name="P:NAnt.Core.DataTypeBase.RefID"> - <summary> - The ID to use as the reference. + <summary> + The ID to use as the reference. </summary> </member> <member name="P:NAnt.Core.DataTypeBase.CanBeReferenced"> @@ -1715,8 +1854,8 @@ </para> <para> Tokens are specified by using the <see cref="T:NAnt.Core.Types.Token"/> element. It is - possoble to specify from 1 to n tokens and replacement values. Values can - be any valid NAnt expression + possible to specify from 1 to n tokens and replacement values. Values can + be any valid NAnt expression. </para> <para> Filters are intended to be used as a element of a <see cref="T:NAnt.Core.Filters.FilterChain"/>. @@ -1773,7 +1912,7 @@ Char as an int or -1 if at the end of the stream. </returns> </member> - <member name="M:NAnt.Core.Filters.ReplaceTokens.InitializeElement(System.Xml.XmlNode)"> + <member name="M:NAnt.Core.Filters.ReplaceTokens.Initialize"> <summary> Initialize the filter by setting its parameters. </summary> @@ -1798,11 +1937,12 @@ </member> <member name="M:NAnt.Core.Filters.ReplaceTokens.CompareCharacters(System.Int32,System.Int32)"> <summary> - Compares to characters taking into account the _ignoreCase flag. + Compares to characters taking <see cref="P:NAnt.Core.Filters.ReplaceTokens.IgnoreCase"/> into account. </summary> <param name="char1"></param> <param name="char2"></param> - <returns></returns> + <returns> + </returns> </member> <member name="P:NAnt.Core.Filters.ReplaceTokens.BeginToken"> <summary> @@ -1920,6 +2060,30 @@ <exception cref="T:System.BadImageFormatException"><paramref name="assemblyFile"/> is not a valid assembly.</exception> <exception cref="T:System.IO.PathTooLongException">An assembly or module was loaded twice with two different evidences, or the assembly name is longer than MAX_PATH characters.</exception> </member> + <member name="M:NAnt.Core.Functions.AssemblyFunctions.Load(System.String)"> + <summary> + Loads an assembly given the long form of its name. + </summary> + <param name="assemblyString">The long form of the assembly name.</param> + <returns> + The loaded assembly. + </returns> + <exception cref="T:System.ArgumentNullException"><paramref name="assemblyString"/> is a <see langword="null"/>.</exception> + <exception cref="T:System.IO.FileNotFoundException"><paramref name="assemblyString"/> is not found.</exception> + <example> + <para> + Determine the location of the Microsoft Access 11 Primary Interop + Assembly by loading it using its fully qualified name, and copy it + to the build directory. + </para> + <code> + <![CDATA[ + <property name="access.pia.path" value="${assembly::get-location(assembly::load('Microsoft.Office.Interop.Access, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'))}" /> + <copy file="${access.pia.path}" todir="${build.dir}" /> + ]]> + </code> + </example> + </member> <member name="M:NAnt.Core.Functions.AssemblyFunctions.GetFullName(System.Reflection.Assembly)"> <summary> Gets the full name of the assembly, also known as the display name. @@ -1982,6 +2146,17 @@ <returns> The full name of the assembly, also known as the display name. </returns> + <example> + <para> + Output the full name of the <c>nunit.framework</c> assembly to the + build log. + </para> + <code> + <![CDATA[ + <echo message="${assemblyname::get-full-name(assemblyname::get-assembly-name('nunit.framework.dll'))}" /> + ]]> + </code> + </example> <seealso cref="M:NAnt.Core.Functions.AssemblyFunctions.GetName(System.Reflection.Assembly)"/> </member> <member name="M:NAnt.Core.Functions.AssemblyNameFunctions.GetName(System.Reflection.AssemblyName)"> @@ -1992,6 +2167,17 @@ <returns> The simple, unencrypted name of the assembly. </returns> + <example> + <para> + Output the simple name of the <c>nunit.framework</c> assembly to + the build log. + </para> + <code> + <![CDATA[ + <echo message="${assemblyname::get-name(assemblyname::get-assembly-name('nunit.framework.dll'))}" /> + ]]> + </code> + </example> <seealso cref="M:NAnt.Core.Functions.AssemblyFunctions.GetName(System.Reflection.Assembly)"/> </member> <member name="M:NAnt.Core.Functions.AssemblyNameFunctions.GetVersion(System.Reflection.AssemblyName)"> @@ -2002,6 +2188,17 @@ <returns> The version of the assembly. </returns> + <example> + <para> + Output the major version of the <c>nunit.framework</c> assembly + to the build log. + </para> + <code> + <![CDATA[ + <echo message="${version::get-major-version(assemblyname::get-version(assemblyname::get-assembly-name('nunit.framework.dll')))}" /> + ]]> + </code> + </example> <seealso cref="M:NAnt.Core.Functions.AssemblyFunctions.GetName(System.Reflection.Assembly)"/> <seealso cref="T:NAnt.Core.Functions.VersionFunctions"/> </member> @@ -2019,6 +2216,17 @@ <remarks> The assembly is not added to this domain. </remarks> + <example> + <para> + Output the full name of the <c>nunit.framework</c> assembly to the + build log. + </para> + <code> + <![CDATA[ + <echo message="${assemblyname::get-full-name(assemblyname::get-assembly-name('nunit.framework.dll'))}" /> + ]]> + </code> + </example> </member> <member name="M:NAnt.Core.Functions.BooleanConversionFunctions.Parse(System.String)"> <summary> @@ -2243,6 +2451,11 @@ <see cref="T:System.Globalization.DateTimeFormatInfo"/> for the invariant culture. </remarks> </member> + <member name="T:NAnt.Core.Functions.DirectoryFunctions"> + <summary> + Groups a set of functions for dealing with directories. + </summary> + </member> <member name="M:NAnt.Core.Functions.DirectoryFunctions.GetCreationTime(System.String)"> <summary> Returns the creation date and time of the specified directory. @@ -2255,15 +2468,6 @@ <exception cref="T:System.ArgumentException"><paramref name="path"/> is a zero-length string, contains only white space, or contains one or more invalid characters.</exception> <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length.</exception> </member> - <member name="M:NAnt.Core.Functions.DirectoryFunctions.GetCurrentDirectory"> - <summary> - Gets the current working directory. - </summary> - <returns> - A <see cref="T:System.String"/> containing the path of the current working - directory. - </returns> - </member> <member name="M:NAnt.Core.Functions.DirectoryFunctions.GetLastWriteTime(System.String)"> <summary> Returns the date and time the specified directory was last written to. @@ -2289,6 +2493,15 @@ <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length.</exception> <exception cref="T:System.NotSupportedException">The <paramref name="path"/> parameter is in an invalid format.</exception> </member> + <member name="M:NAnt.Core.Functions.DirectoryFunctions.GetCurrentDirectory"> + <summary> + Gets the current working directory. + </summary> + <returns> + A <see cref="T:System.String"/> containing the path of the current working + directory. + </returns> + </member> <member name="M:NAnt.Core.Functions.DirectoryFunctions.GetParentDirectory(System.String)"> <summary> Retrieves the parent directory of the specified path. @@ -2349,6 +2562,20 @@ </code> </example> </member> + <member name="T:NAnt.Core.Functions.DnsFunctions"> + <summary> + Functions for requesting information from DNS. + </summary> + </member> + <member name="M:NAnt.Core.Functions.DnsFunctions.GetHostName"> + <summary> + Gets the host name of the local computer. + </summary> + <returns> + A string that contains the DNS host name of the local computer. + </returns> + <exception cref="T:System.Net.Sockets.SocketException">An error is encountered when resolving the local host name.</exception> + </member> <member name="M:NAnt.Core.Functions.DoubleConversionFunctions.Parse(System.String)"> <summary> Converts the specified string representation of a number to its @@ -2517,6 +2744,11 @@ </code> </example> </member> + <member name="T:NAnt.Core.Functions.FileFunctions"> + <summary> + Groups a set of functions for dealing with files. + </summary> + </member> <member name="M:NAnt.Core.Functions.FileFunctions.GetCreationTime(System.String)"> <summary> Returns the creation date and time of the specified file. @@ -2610,7 +2842,6 @@ <exception cref="T:System.ArgumentException"><paramref name="assemblyFile"/> is an empty <see cref="T:System.String"/>.</exception> <exception cref="T:System.IO.FileNotFoundException"><paramref name="assemblyFile"/> is not found, or the file you are trying to check does not specify a filename extension.</exception> <exception cref="T:System.Security.SecurityException">The caller does not have path discovery permission.</exception> - <exception cref="T:System.IO.FileLoadException">The file could not be loaded for some reason.</exception> </member> <member name="T:NAnt.Core.Functions.FileVersionInfoFunctions"> <summary> @@ -2841,6 +3072,18 @@ <see langword="true" /> if the specified target exists; otherwise, <see langword="false" />. </returns> + <example> + <para> + Execute target "clean", if it exists. + </para> + <code> + <![CDATA[ + <if test="${target::exists('clean')}"> + <call target="clean" /> + </if> + ]]> + </code> + </example> </member> <member name="M:NAnt.Core.Functions.TargetFunctions.GetCurrentTarget"> <summary> @@ -2873,15 +3116,14 @@ <see langword="false" />. </returns> </member> - <member name="M:NAnt.Core.Functions.TaskFunctions.GetLocation(System.String)"> + <member name="M:NAnt.Core.Functions.TaskFunctions.GetAssembly(System.String)"> <summary> - Returns the filename of the assembly from which the specified task + Returns the <see cref="T:System.Reflection.Assembly"/> from which the specified task was loaded. </summary> - <param name="name">The task to get the location of.</param> + <param name="name">The name of the task to get the <see cref="T:System.Reflection.Assembly"/> of.</param> <returns> - The filename of the assembly from which the specified task was - loaded. + The <see cref="T:System.Reflection.Assembly"/> from which the specified task was loaded. </returns> <exception cref="T:System.ArgumentException">Task <paramref name="name"/> is not available.</exception> </member> @@ -2895,8 +3137,19 @@ <see langword="false" />. </returns> <example> - <para>Check whether the "debug" property exists.</para> - <code>property::exists('debug')</code> + <para> + Execute a set of tasks if the "build.debug" property + exists. + </para> + <code> + <![CDATA[ + <if test="${property::exists('build.debug')}"> + <echo message="Starting debug build" /> + <call target="init-debug" /> + <call target="build" /> + </if> + ]]> + </code> </example> </member> <member name="M:NAnt.Core.Functions.PropertyFunctions.IsReadOnly(System.String)"> @@ -2933,11 +3186,11 @@ </member> <member name="M:NAnt.Core.Functions.FrameworkFunctions.Exists(System.String)"> <summary> - Checks whether the specified framework exists. + Checks whether the specified framework exists, and is valid. </summary> - <param name="name">The framework to test.</param> + <param name="framework">The framework to test.</param> <returns> - <see langword="true" /> if the specified framework exists; otherwise, + <see langword="true" /> if the specified framework exists ; otherwise, <see langword="false" />. </returns> </member> @@ -2945,7 +3198,7 @@ <summary> Checks whether the SDK for the specified framework is installed. </summary> - <param name="name">The framework to test.</param> + <param name="framework">The framework to test.</param> <returns> <see langword="true"/> if the SDK for specified framework is installed; otherwise, <see langword="false"/>. @@ -3055,6 +3308,38 @@ <seealso cref="M:NAnt.Core.Functions.FrameworkFunctions.GetRuntimeFramework"/> <seealso cref="M:NAnt.Core.Functions.FrameworkFunctions.GetTargetFramework"/> </member> + <member name="M:NAnt.Core.Functions.FrameworkFunctions.GetToolPath(System.String)"> + <summary> + Gets the absolute path of the specified tool for the current + target framework. + </summary> + <param name="tool">The file name of the tool to search for.</param> + <returns> + The absolute path to <paramref name="tool"/> if found in one of the + configured tool paths; otherwise, an error is reported. + </returns> + <exception cref="T:System.IO.FileNotFoundException"><paramref name="tool"/> could not be found in the configured tool paths.</exception> + <remarks> + <para> + The configured tool paths are scanned in the order in which they + are defined in the framework configuration. + </para> + <para> + The file name of the tool to search should include the extension. + </para> + </remarks> + <example> + <para>Use <b>gacutil</b> to install an assembly in the GAC.</para> + <code> + <![CDATA[ + <exec program="${framework::get-tool-path('gacutil.exe')}" managed="strict"> + <arg value="/i" /> + <arg file="Cegeka.HealthFramework.dll" /> + </exec> + ]]> + </code> + </example> + </member> <member name="M:NAnt.Core.Functions.FrameworkFunctions.GetRuntimeEngine(System.String)"> <summary> Gets the runtime engine of the specified framework. @@ -3069,7 +3354,7 @@ <seealso cref="M:NAnt.Core.Functions.FrameworkFunctions.GetRuntimeFramework"/> <seealso cref="M:NAnt.Core.Functions.FrameworkFunctions.GetTargetFramework"/> </member> - <member name="M:NAnt.Core.Functions.FrameworkFunctions.CheckFramework(System.String)"> + <member name="M:NAnt.Core.Functions.FrameworkFunctions.GetFramework(System.String)"> <summary> Checks whether the specified framework is valid. </summary> @@ -3735,13 +4020,13 @@ <code>string::last-index-of('testing string', 'test') ==> 0</code> </example> <example> - <code>string::last-index-of('testing string', '') ==> 0</code> + <code>string::last-index-of('testing string', '') ==> 13</code> </example> <example> <code>string::last-index-of('testing string', 'Test') ==> -1</code> </example> <example> - <code>string::last-index-of('testing string', 'ing') ==> 4</code> + <code>string::last-index-of('testing string', 'ing') ==> 11</code> </example> </member> <member name="M:NAnt.Core.Functions.StringFunctions.PadLeft(System.String,System.Int32,System.String)"> @@ -3917,6 +4202,19 @@ The number of whole days represented by the given <see cref="T:System.TimeSpan"/>. </returns> + <example> + <para> + Remove all files that have not been modified in the last 7 days from directory "binaries".</para> + <code> + <![CDATA[ + <foreach item="File" in="binaries" property="filename"> + <if test="${timespan::get-days(datetime::now() - file::get-last-write-time(filename)) >= 7}"> + <delete file="${filename}" /> + </if> + </foreach> + ]]> + </code> + </example> </member> <member name="M:NAnt.Core.Functions.TimeSpanFunctions.GetHours(System.TimeSpan)"> <summary> @@ -4211,9 +4509,9 @@ The actual logging is delegated to the project. </para> <para> - If the <see cref="P:NAnt.Core.Task.Verbose"/> attribute is set on the task and a - message is logged with level <see cref="F:NAnt.Core.Level.Verbose"/>, the - priority of the message will be increased to <see cref="F:NAnt.Core.Level.Info"/>. + If the <see cref="P:NAnt.Core.Task.Verbose"/> attribute is set on the task and a + message is logged with level <see cref="F:NAnt.Core.Level.Verbose"/>, the + priority of the message will be increased to <see cref="F:NAnt.Core.Level.Info"/> when the threshold of the build log is <see cref="F:NAnt.Core.Level.Info"/>. </para> <para> @@ -4221,6 +4519,11 @@ the build log itself is still configured with threshold <see cref="F:NAnt.Core.Level.Info"/>. </para> + <para> + The threshold of the project is not taken into account to determine + whether a message should be passed to the logging infrastructure, + as build listeners might be interested in receiving all messages. + </para> </remarks> </member> <member name="M:NAnt.Core.Task.Log(NAnt.Core.Level,System.String,System.Object[])"> @@ -4255,8 +4558,14 @@ <param name="messageLevel">The <see cref="T:NAnt.Core.Level"/> to check.</param> <returns> <see langword="true"/> if messages with the given <see cref="T:NAnt.Core.Level"/> - will be output in the build log; otherwise, <see langword="false"/>. + should be passed on to the logging infrastructure; otherwise, + <see langword="false"/>. </returns> + <remarks> + The threshold of the project is not taken into account to determine + whether a message should be passed to the logging infrastructure, + as build listeners might be interested in receiving all messages. + </remarks> </member> <member name="M:NAnt.Core.Task.InitializeTaskConfiguration"> <summary> @@ -4269,8 +4578,8 @@ file if a build element is constructed from code. </remarks> </member> - <member name="M:NAnt.Core.Task.InitializeElement(System.Xml.XmlNode)"> - <summary><note>Deprecated (to be deleted).</note></summary> + <member name="M:NAnt.Core.Task.Initialize"> + <summary>Initializes the task.</summary> </member> <member name="M:NAnt.Core.Task.InitializeTask(System.Xml.XmlNode)"> <summary>Initializes the task.</summary> @@ -4278,6 +4587,25 @@ <member name="M:NAnt.Core.Task.ExecuteTask"> <summary>Executes the task.</summary> </member> + <member name="M:NAnt.Core.Task.GetAttributeConfigurationNode(NAnt.Core.FrameworkInfo,System.String)"> + <summary> + Locates the XML node for the specified attribute in either the + configuration section of the extension assembly or the.project. + </summary> + <param name="attributeName">The name of attribute for which the XML configuration node should be located.</param> + <param name="framework">The framework to use to obtain framework specific information, or <see langword="null" /> if no framework specific information should be used.</param> + <returns> + The XML configuration node for the specified attribute, or + <see langword="null" /> if no corresponding XML node could be + located. + </returns> + <remarks> + If there's a valid current framework, the configuration section for + that framework will first be searched. If no corresponding + configuration node can be located in that section, the framework-neutral + section of the project configuration node will be searched. + </remarks> + </member> <member name="P:NAnt.Core.Task.FailOnError"> <summary> Determines if task failure stops the build, or is just reported. @@ -4316,17 +4644,24 @@ <member name="P:NAnt.Core.Task.Threshold"> <summary> Gets or sets the log threshold for this <see cref="T:NAnt.Core.Task"/>. By - default the threshold of a task matches the threshold of the project. + default the threshold of a task is <see cref="F:NAnt.Core.Level.Debug"/>, + causing no messages to be filtered in the task itself. </summary> <value> The log threshold level for this <see cref="T:NAnt.Core.Task"/>. </value> <remarks> - Setting the threshold of a <see cref="T:NAnt.Core.Task"/> higher than the - threshold of the its <see cref="T:NAnt.Core.Project"/> does not have any - effect. + When the threshold of a <see cref="T:NAnt.Core.Task"/> is higher than the + threshold of the <see cref="T:NAnt.Core.Project"/>, then all messages will + still be delivered to the build listeners. </remarks> </member> + <member name="P:NAnt.Core.Task.TaskBuilder"> + <summary> + Returns the TaskBuilder used to construct an instance of this + <see cref="T:NAnt.Core.Task"/>. + </summary> + </member> <member name="P:NAnt.Core.Tasks.AttribTask.File"> <summary> The name of the file which will have its attributes set. This is @@ -4561,10 +4896,23 @@ target and all its dependent targets will be re-executed. </para> <para> - To avoid dependent targets from being executed more than once, an "unless" - attribute with value "${<see href="../functions/target.has-executed.html">target::has-executed</see>('<c><target name></c>')}" - should be added to the dependent targets. + To avoid dependent targets from being executed more than once, two + options are available: </para> + <list type="bullet"> + <item> + <description> + Add an "unless" attribute with value "${<see href="../functions/target.has-executed.html">target::has-executed</see>('<c><target name></c>')}" + to the dependent targets. + </description> + </item> + <item> + <description> + Set the <see cref="P:NAnt.Core.Tasks.CallTask.CascadeDependencies"/> attribute on the + <see cref="T:NAnt.Core.Tasks.CallTask"/> to <see langword="false "/> (<c>recommended</c>). + </description> + </item> + </list> </remarks> <example> <para> @@ -4585,7 +4933,7 @@ <![CDATA[ <project default="build"> <property name="debug" value="false" /> - <target name="init" unless="${target::has-executed('init')}"> + <target name="init"> <echo message="initializing" /> </target> <target name="compile" depends="init"> @@ -4600,6 +4948,61 @@ </project> ]]> </code> + <para> + The <see cref="P:NAnt.Core.Tasks.CallTask.CascadeDependencies"/> parameter of the + <see cref="T:NAnt.Core.Tasks.CallTask"/> defaults to <see langword="true"/>, + causing the "init" target to be executed for both + the "debug" and "release" build. + </para> + <para> + This results in the following build log: + </para> + <code> + build: + + init: + + [echo] initializing + + compile: + + [echo] compiling with debug = false + + init: + + [echo] initializing + + compile: + + [echo] compiling with debug = true + + BUILD SUCCEEDED + </code> + <para> + If the "init" should only be executed once, set the + <see cref="P:NAnt.Core.Tasks.CallTask.CascadeDependencies"/> attribute of the <see cref="T:NAnt.Core.Tasks.CallTask"/> + to <see langword="false"/>. + </para> + <para> + The build log would then look like this: + </para> + <code> + build: + + init: + + [echo] initializing + + compile: + + [echo] compiling with debug = false + + compile: + + [echo] compiling with debug = true + + BUILD SUCCEEDED + </code> </example> </member> <member name="M:NAnt.Core.Tasks.CallTask.ExecuteTask"> @@ -4607,12 +5010,11 @@ Executes the specified target. </summary> </member> - <member name="M:NAnt.Core.Tasks.CallTask.InitializeTask(System.Xml.XmlNode)"> + <member name="M:NAnt.Core.Tasks.CallTask.Initialize"> <summary> Makes sure the <see cref="T:NAnt.Core.Tasks.CallTask"/> is not calling its own parent. </summary> - <param name="taskNode">The task XML node.</param> </member> <member name="P:NAnt.Core.Tasks.CallTask.TargetName"> <summary> @@ -4627,8 +5029,8 @@ </member> <member name="P:NAnt.Core.Tasks.CallTask.CascadeDependencies"> <summary> - Cascade all the specified targets dependencies. The - default is <see langword="true" />. + Execute the specified targets dependencies -- even if they have been + previously executed. The default is <see langword="true" />. </summary> </member> <member name="T:NAnt.Core.Tasks.CopyTask"> @@ -4724,11 +5126,10 @@ Initialize new instance of the <see cref="T:NAnt.Core.Tasks.CopyTask"/>. </summary> </member> - <member name="M:NAnt.Core.Tasks.CopyTask.InitializeTask(System.Xml.XmlNode)"> + <member name="M:NAnt.Core.Tasks.CopyTask.Initialize"> <summary> Checks whether the task is initialized with valid attributes. </summary> - <param name="taskNode">The <see ... [truncated message content] |