|
From: <jer...@us...> - 2008-05-28 03:58:53
|
Revision: 107
http://structuremap.svn.sourceforge.net/structuremap/?rev=107&view=rev
Author: jeremydmiller
Date: 2008-05-27 20:58:49 -0700 (Tue, 27 May 2008)
Log Message:
-----------
Renaming CreateInstance to GetInstance in InstanceManager to be consistent with ObjectFactory, renaming IInstanceManager.cs to IContainer
Modified Paths:
--------------
trunk/Source/StructureMap/Configuration/GraphBuilder.cs
trunk/Source/StructureMap/ExplicitArgsExpression.cs
trunk/Source/StructureMap/InstanceManager.cs
trunk/Source/StructureMap/ObjectFactory.cs
trunk/Source/StructureMap/StructureMap.csproj
trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs
trunk/Source/StructureMap.Testing/AutoMocking/RhinoAutoMockerTester.cs
trunk/Source/StructureMap.Testing/BuildSessionTester.cs
trunk/Source/StructureMap.Testing/Configuration/ConfigurationParserTester.cs
trunk/Source/StructureMap.Testing/Configuration/DSL/AddInstanceTester.cs
trunk/Source/StructureMap.Testing/Configuration/DSL/AddTypesTester.cs
trunk/Source/StructureMap.Testing/Configuration/DSL/ConstructorExpressionTester.cs
trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs
trunk/Source/StructureMap.Testing/Configuration/DSL/DeepInstanceTester.cs
trunk/Source/StructureMap.Testing/Configuration/DSL/GenericFamilyExpressionTester.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/ProfileExpressionTester.cs
trunk/Source/StructureMap.Testing/Configuration/DefaultInstanceNodeTester.cs
trunk/Source/StructureMap.Testing/Configuration/InlineInstanceDefinitionInProfileAndMachineNodesTester.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/EnumerationTester.cs
trunk/Source/StructureMap.Testing/Container/ExceptionHandling/StructureMapExceptionTester.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/Interceptors/TypeInterceptionTester.cs
trunk/Source/StructureMap.Testing/Container/SetterInjectionEmittingTester.cs
trunk/Source/StructureMap.Testing/Container/TypeFindingTester.cs
trunk/Source/StructureMap.Testing/GenericsAcceptanceTester.cs
trunk/Source/StructureMap.Testing/GenericsIntegrationTester.cs
trunk/Source/StructureMap.Testing/Graph/GenericsPluginGraphTester.cs
trunk/Source/StructureMap.Testing/Graph/PluginFamilyTester.cs
trunk/Source/StructureMap.Testing/Graph/PluginTester.cs
trunk/Source/StructureMap.Testing/ImplicitPluginFromPluggedTypeAttributeTester.cs
Added Paths:
-----------
trunk/Source/StructureMap/IContainer.cs
Removed Paths:
-------------
trunk/Source/StructureMap/IInstanceManager.cs
Modified: trunk/Source/StructureMap/Configuration/GraphBuilder.cs
===================================================================
--- trunk/Source/StructureMap/Configuration/GraphBuilder.cs 2008-05-28 03:35:02 UTC (rev 106)
+++ trunk/Source/StructureMap/Configuration/GraphBuilder.cs 2008-05-28 03:58:49 UTC (rev 107)
@@ -115,7 +115,7 @@
_systemInstanceManager = new InstanceManager(_systemGraph);
}
- return _systemInstanceManager.CreateInstance(type, instance);
+ return _systemInstanceManager.GetInstance(type, instance);
}
}
}
\ No newline at end of file
Modified: trunk/Source/StructureMap/ExplicitArgsExpression.cs
===================================================================
--- trunk/Source/StructureMap/ExplicitArgsExpression.cs 2008-05-28 03:35:02 UTC (rev 106)
+++ trunk/Source/StructureMap/ExplicitArgsExpression.cs 2008-05-28 03:58:49 UTC (rev 107)
@@ -10,10 +10,10 @@
public class ExplicitArgsExpression : IExplicitProperty
{
private readonly ExplicitArguments _args = new ExplicitArguments();
- private readonly IInstanceManager _manager;
+ private readonly IContainer _manager;
private string _lastArgName;
- internal ExplicitArgsExpression(IInstanceManager manager)
+ internal ExplicitArgsExpression(IContainer manager)
{
_manager = manager;
}
@@ -43,7 +43,7 @@
public T GetInstance<T>()
{
- return _manager.CreateInstance<T>(_args);
+ return _manager.GetInstance<T>(_args);
}
}
}
\ No newline at end of file
Added: trunk/Source/StructureMap/IContainer.cs
===================================================================
--- trunk/Source/StructureMap/IContainer.cs (rev 0)
+++ trunk/Source/StructureMap/IContainer.cs 2008-05-28 03:58:49 UTC (rev 107)
@@ -0,0 +1,82 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using StructureMap.Pipeline;
+
+namespace StructureMap
+{
+ public interface IContainer
+ {
+ T GetInstance<T>(string instanceKey);
+ T GetInstance<T>();
+ T FillDependencies<T>();
+ object FillDependencies(Type type);
+ void InjectStub<T>(T instance);
+ IList<T> GetAllInstances<T>();
+ void SetDefaultsToProfile(string profile);
+
+ T GetInstance<T>(Instance instance);
+
+ /// <summary>
+ /// Sets up the InstanceManager to return the object in the "stub" argument anytime
+ /// any instance of the PluginType is requested
+ /// </summary>
+ /// <param name="pluginType"></param>
+ /// <param name="stub"></param>
+ void InjectStub(Type pluginType, object stub);
+
+ IList GetAllInstances(Type type);
+ void AddInstance<T>(Instance instance);
+ void AddInstance<PLUGINTYPE, CONCRETETYPE>() where CONCRETETYPE : PLUGINTYPE;
+ void AddDefaultInstance<PLUGINTYPE, CONCRETETYPE>();
+ void Inject<PLUGINTYPE>(PLUGINTYPE instance);
+ void InjectByName<PLUGINTYPE>(PLUGINTYPE instance, string instanceKey);
+ void InjectByName<PLUGINTYPE, CONCRETETYPE>(string instanceKey);
+
+ string WhatDoIHave();
+
+ /// <summary>
+ /// Sets the default instance for the PluginType
+ /// </summary>
+ /// <param name="pluginType"></param>
+ /// <param name="instance"></param>
+ void SetDefault(Type pluginType, Instance instance);
+
+ /// <summary>
+ /// Sets the default instance for the PluginType
+ /// </summary>
+ /// <param name="pluginType"></param>
+ /// <param name="instanceKey"></param>
+ void SetDefault(Type pluginType, string instanceKey);
+
+ /// <summary>
+ /// Creates a new object instance of the requested type
+ /// </summary>
+ /// <param name="pluginType"></param>
+ /// <returns></returns>
+ object GetInstance(Type pluginType);
+
+
+ /// <summary>
+ /// Creates a new instance of the requested type using the InstanceMemento. Mostly used from other
+ /// classes to link children members
+ /// </summary>
+ /// <param name="pluginType"></param>
+ /// <param name="instance"></param>
+ /// <returns></returns>
+ object GetInstance(Type pluginType, Instance instance);
+
+ /// <summary>
+ /// Creates the named instance of the PluginType
+ /// </summary>
+ /// <param name="pluginType"></param>
+ /// <param name="instanceKey"></param>
+ /// <returns></returns>
+ object GetInstance(Type pluginType, string instanceKey);
+
+ PLUGINTYPE GetInstance<PLUGINTYPE>(ExplicitArguments args);
+
+ ExplicitArgsExpression With<T>(T arg);
+ IExplicitProperty With(string argName);
+ }
+}
\ No newline at end of file
Deleted: trunk/Source/StructureMap/IInstanceManager.cs
===================================================================
--- trunk/Source/StructureMap/IInstanceManager.cs 2008-05-28 03:35:02 UTC (rev 106)
+++ trunk/Source/StructureMap/IInstanceManager.cs 2008-05-28 03:58:49 UTC (rev 107)
@@ -1,82 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using StructureMap.Pipeline;
-
-namespace StructureMap
-{
- public interface IInstanceManager
- {
- T CreateInstance<T>(string instanceKey);
- T CreateInstance<T>();
- T FillDependencies<T>();
- object FillDependencies(Type type);
- void InjectStub<T>(T instance);
- IList<T> GetAllInstances<T>();
- void SetDefaultsToProfile(string profile);
-
- T CreateInstance<T>(Instance instance);
-
- /// <summary>
- /// Sets up the InstanceManager to return the object in the "stub" argument anytime
- /// any instance of the PluginType is requested
- /// </summary>
- /// <param name="pluginType"></param>
- /// <param name="stub"></param>
- void InjectStub(Type pluginType, object stub);
-
- IList GetAllInstances(Type type);
- void AddInstance<T>(Instance instance);
- void AddInstance<PLUGINTYPE, CONCRETETYPE>() where CONCRETETYPE : PLUGINTYPE;
- void AddDefaultInstance<PLUGINTYPE, CONCRETETYPE>();
- void Inject<PLUGINTYPE>(PLUGINTYPE instance);
- void InjectByName<PLUGINTYPE>(PLUGINTYPE instance, string instanceKey);
- void InjectByName<PLUGINTYPE, CONCRETETYPE>(string instanceKey);
-
- string WhatDoIHave();
-
- /// <summary>
- /// Sets the default instance for the PluginType
- /// </summary>
- /// <param name="pluginType"></param>
- /// <param name="instance"></param>
- void SetDefault(Type pluginType, Instance instance);
-
- /// <summary>
- /// Sets the default instance for the PluginType
- /// </summary>
- /// <param name="pluginType"></param>
- /// <param name="instanceKey"></param>
- void SetDefault(Type pluginType, string instanceKey);
-
- /// <summary>
- /// Creates a new object instance of the requested type
- /// </summary>
- /// <param name="pluginType"></param>
- /// <returns></returns>
- object CreateInstance(Type pluginType);
-
-
- /// <summary>
- /// Creates a new instance of the requested type using the InstanceMemento. Mostly used from other
- /// classes to link children members
- /// </summary>
- /// <param name="pluginType"></param>
- /// <param name="instance"></param>
- /// <returns></returns>
- object CreateInstance(Type pluginType, Instance instance);
-
- /// <summary>
- /// Creates the named instance of the PluginType
- /// </summary>
- /// <param name="pluginType"></param>
- /// <param name="instanceKey"></param>
- /// <returns></returns>
- object CreateInstance(Type pluginType, string instanceKey);
-
- PLUGINTYPE CreateInstance<PLUGINTYPE>(ExplicitArguments args);
-
- ExplicitArgsExpression With<T>(T arg);
- IExplicitProperty With(string argName);
- }
-}
\ No newline at end of file
Modified: trunk/Source/StructureMap/InstanceManager.cs
===================================================================
--- trunk/Source/StructureMap/InstanceManager.cs 2008-05-28 03:35:02 UTC (rev 106)
+++ trunk/Source/StructureMap/InstanceManager.cs 2008-05-28 03:58:49 UTC (rev 107)
@@ -14,7 +14,7 @@
/// <summary>
/// A collection of IInstanceFactory's.
/// </summary>
- public class InstanceManager : TypeRules, IInstanceManager
+ public class InstanceManager : TypeRules, IContainer
{
private InterceptorLibrary _interceptorLibrary;
private PipelineGraph _pipelineGraph;
@@ -65,24 +65,24 @@
set { _pipelineGraph.OnMissingFactory = value; }
}
- #region IInstanceManager Members
+ #region IContainer Members
- public T CreateInstance<T>(string instanceKey)
+ public T GetInstance<T>(string instanceKey)
{
- return (T) CreateInstance(typeof (T), instanceKey);
+ return (T) GetInstance(typeof (T), instanceKey);
}
- public T CreateInstance<T>(Instance instance)
+ public T GetInstance<T>(Instance instance)
{
- return (T) CreateInstance(typeof (T), instance);
+ return (T) GetInstance(typeof (T), instance);
}
- public PLUGINTYPE CreateInstance<PLUGINTYPE>(ExplicitArguments args)
+ public PLUGINTYPE GetInstance<PLUGINTYPE>(ExplicitArguments args)
{
Instance defaultInstance = _pipelineGraph.GetDefault(typeof (PLUGINTYPE));
ExplicitInstance<PLUGINTYPE> instance = new ExplicitInstance<PLUGINTYPE>(args, defaultInstance);
- return CreateInstance<PLUGINTYPE>(instance);
+ return GetInstance<PLUGINTYPE>(instance);
}
public void Inject<PLUGINTYPE>(PLUGINTYPE instance)
@@ -106,9 +106,9 @@
AddInstance<PLUGINTYPE>(instance);
}
- public T CreateInstance<T>()
+ public T GetInstance<T>()
{
- return (T) CreateInstance(typeof (T));
+ return (T) GetInstance(typeof (T));
}
public T FillDependencies<T>()
@@ -146,7 +146,7 @@
/// <param name="pluginType"></param>
/// <param name="instanceKey"></param>
/// <returns></returns>
- public object CreateInstance(Type pluginType, string instanceKey)
+ public object GetInstance(Type pluginType, string instanceKey)
{
return withNewSession().CreateInstance(pluginType, instanceKey);
}
@@ -157,7 +157,7 @@
/// </summary>
/// <param name="pluginType"></param>
/// <returns></returns>
- public object CreateInstance(Type pluginType)
+ public object GetInstance(Type pluginType)
{
return withNewSession().CreateInstance(pluginType);
}
@@ -170,7 +170,7 @@
/// <param name="pluginType"></param>
/// <param name="instance"></param>
/// <returns></returns>
- public object CreateInstance(Type pluginType, Instance instance)
+ public object GetInstance(Type pluginType, Instance instance)
{
return withNewSession().CreateInstance(pluginType, instance);
}
@@ -216,7 +216,7 @@
throw new StructureMapException(230, type.FullName);
}
- return CreateInstance(type);
+ return GetInstance(type);
}
/// <summary>
Modified: trunk/Source/StructureMap/ObjectFactory.cs
===================================================================
--- trunk/Source/StructureMap/ObjectFactory.cs 2008-05-28 03:35:02 UTC (rev 106)
+++ trunk/Source/StructureMap/ObjectFactory.cs 2008-05-28 03:58:49 UTC (rev 107)
@@ -16,7 +16,7 @@
public class ObjectFactory
{
private static readonly object _lockObject = new object();
- private static IInstanceManager _manager;
+ private static IContainer _manager;
private static string _profile = string.Empty;
private static event Notify _notify;
@@ -131,7 +131,7 @@
#region InstanceManager and setting defaults
- private static IInstanceManager manager
+ private static IContainer manager
{
get
{
@@ -184,7 +184,7 @@
/// Strictly used for testing scenarios
/// </summary>
/// <param name="manager"></param>
- internal static void ReplaceManager(IInstanceManager manager)
+ internal static void ReplaceManager(IContainer manager)
{
_manager = manager;
}
@@ -246,7 +246,7 @@
/// <returns></returns>
public static object GetInstance(Type TargetType)
{
- return manager.CreateInstance(TargetType);
+ return manager.GetInstance(TargetType);
}
/// <summary>
@@ -256,7 +256,7 @@
/// <returns></returns>
public static TargetType GetInstance<TargetType>()
{
- return (TargetType) manager.CreateInstance(typeof (TargetType));
+ return (TargetType) manager.GetInstance(typeof (TargetType));
}
/// <summary>
@@ -267,7 +267,7 @@
/// <returns></returns>
public static object GetInstance(Type TargetType, Instance instance)
{
- return manager.CreateInstance(TargetType, instance);
+ return manager.GetInstance(TargetType, instance);
}
/// <summary>
@@ -278,7 +278,7 @@
/// <returns></returns>
public static TargetType GetInstance<TargetType>(Instance instance)
{
- return (TargetType) manager.CreateInstance(typeof (TargetType), instance);
+ return (TargetType) manager.GetInstance(typeof (TargetType), instance);
}
/// <summary>
@@ -289,7 +289,7 @@
/// <returns></returns>
public static object GetNamedInstance(Type TargetType, string InstanceName)
{
- return manager.CreateInstance(TargetType, InstanceName);
+ return manager.GetInstance(TargetType, InstanceName);
}
/// <summary>
@@ -300,7 +300,7 @@
/// <returns></returns>
public static TargetType GetNamedInstance<TargetType>(string InstanceName)
{
- return (TargetType) manager.CreateInstance(typeof (TargetType), InstanceName);
+ return (TargetType) manager.GetInstance(typeof (TargetType), InstanceName);
}
/// <summary>
Modified: trunk/Source/StructureMap/StructureMap.csproj
===================================================================
--- trunk/Source/StructureMap/StructureMap.csproj 2008-05-28 03:35:02 UTC (rev 106)
+++ trunk/Source/StructureMap/StructureMap.csproj 2008-05-28 03:58:49 UTC (rev 107)
@@ -285,7 +285,7 @@
<Compile Include="IInstanceFactory.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="IInstanceManager.cs" />
+ <Compile Include="IContainer.cs" />
<Compile Include="InstanceBuilder.cs">
<SubType>Code</SubType>
</Compile>
Modified: trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs
===================================================================
--- trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs 2008-05-28 03:35:02 UTC (rev 106)
+++ trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs 2008-05-28 03:58:49 UTC (rev 107)
@@ -60,7 +60,7 @@
foreach (ParameterInfo parameterInfo in ctor.GetParameters())
{
Type dependencyType = parameterInfo.ParameterType;
- object dependency = _manager.CreateInstance(dependencyType);
+ object dependency = _manager.GetInstance(dependencyType);
list.Add(dependency);
}
@@ -71,7 +71,7 @@
// of the ClassUnderTest
public T Get<T>()
{
- return _manager.CreateInstance<T>();
+ return _manager.GetInstance<T>();
}
// Set the auto mocking container to use a Stub for Type T
Modified: trunk/Source/StructureMap.Testing/AutoMocking/RhinoAutoMockerTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/AutoMocking/RhinoAutoMockerTester.cs 2008-05-28 03:35:02 UTC (rev 106)
+++ trunk/Source/StructureMap.Testing/AutoMocking/RhinoAutoMockerTester.cs 2008-05-28 03:58:49 UTC (rev 107)
@@ -132,9 +132,9 @@
[Test]
public void AutoFillAConcreteClassWithMocks()
{
- IMockedService service = _instanceManager.CreateInstance<IMockedService>();
- IMockedService2 service2 = _instanceManager.CreateInstance<IMockedService2>();
- IMockedService3 service3 = _instanceManager.CreateInstance<IMockedService3>();
+ IMockedService service = _instanceManager.GetInstance<IMockedService>();
+ IMockedService2 service2 = _instanceManager.GetInstance<IMockedService2>();
+ IMockedService3 service3 = _instanceManager.GetInstance<IMockedService3>();
ConcreteClass concreteClass = _instanceManager.FillDependencies<ConcreteClass>();
@@ -146,7 +146,7 @@
[Test]
public void GetAFullMockForAServiceThatHasNotPreviouslyBeenRequested()
{
- IMockedService service = _instanceManager.CreateInstance<IMockedService>();
+ IMockedService service = _instanceManager.GetInstance<IMockedService>();
Assert.IsNotNull(service);
@@ -171,19 +171,19 @@
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>());
+ Assert.AreSame(stub, _instanceManager.GetInstance<IMockedService>());
+ Assert.AreSame(stub, _instanceManager.GetInstance<IMockedService>());
+ Assert.AreSame(stub, _instanceManager.GetInstance<IMockedService>());
}
[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>());
+ IMockedService service = _instanceManager.GetInstance<IMockedService>();
+ Assert.AreSame(service, _instanceManager.GetInstance<IMockedService>());
+ Assert.AreSame(service, _instanceManager.GetInstance<IMockedService>());
+ Assert.AreSame(service, _instanceManager.GetInstance<IMockedService>());
+ Assert.AreSame(service, _instanceManager.GetInstance<IMockedService>());
}
[Test]
Modified: trunk/Source/StructureMap.Testing/BuildSessionTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/BuildSessionTester.cs 2008-05-28 03:35:02 UTC (rev 106)
+++ trunk/Source/StructureMap.Testing/BuildSessionTester.cs 2008-05-28 03:58:49 UTC (rev 107)
@@ -138,14 +138,14 @@
[Test]
public void If_no_child_array_is_explicitly_defined_return_all_instances()
{
- IInstanceManager manager = new InstanceManager(delegate(Registry registry)
+ IContainer manager = new InstanceManager(delegate(Registry registry)
{
registry.AddInstanceOf<IWidget>(new ColorWidget("Red"));
registry.AddInstanceOf<IWidget>(new ColorWidget("Blue"));
registry.AddInstanceOf<IWidget>(new ColorWidget("Green"));
});
- WidgetHolder holder = manager.CreateInstance<WidgetHolder>();
+ WidgetHolder holder = manager.GetInstance<WidgetHolder>();
Assert.AreEqual(3, holder.Widgets.Length);
}
Modified: trunk/Source/StructureMap.Testing/Configuration/ConfigurationParserTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Configuration/ConfigurationParserTester.cs 2008-05-28 03:35:02 UTC (rev 106)
+++ trunk/Source/StructureMap.Testing/Configuration/ConfigurationParserTester.cs 2008-05-28 03:58:49 UTC (rev 107)
@@ -62,11 +62,11 @@
InstanceManager manager = new InstanceManager(graph);
- GrandChild tommy = (GrandChild) manager.CreateInstance(typeof (GrandChild), "Tommy");
+ GrandChild tommy = (GrandChild) manager.GetInstance(typeof (GrandChild), "Tommy");
Assert.AreEqual(false, tommy.RightHanded);
Assert.AreEqual(1972, tommy.BirthYear);
- ColorWidget blue = (ColorWidget) manager.CreateInstance(typeof (IWidget), "Blue");
+ ColorWidget blue = (ColorWidget) manager.GetInstance(typeof (IWidget), "Blue");
Assert.AreEqual("Blue", blue.Color);
}
}
Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/AddInstanceTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Configuration/DSL/AddInstanceTester.cs 2008-05-28 03:35:02 UTC (rev 106)
+++ trunk/Source/StructureMap.Testing/Configuration/DSL/AddInstanceTester.cs 2008-05-28 03:58:49 UTC (rev 107)
@@ -46,33 +46,33 @@
#endregion
- private IInstanceManager manager;
+ private IContainer manager;
[Test]
public void AddAnInstanceWithANameAndAPropertySpecifyingConcreteKey()
{
- ColorWidget widget = (ColorWidget) manager.CreateInstance<IWidget>("Purple");
+ ColorWidget widget = (ColorWidget) manager.GetInstance<IWidget>("Purple");
Assert.AreEqual("Purple", widget.Color);
}
[Test]
public void AddAnInstanceWithANameAndAPropertySpecifyingConcreteType()
{
- ColorWidget widget = (ColorWidget) manager.CreateInstance<IWidget>("DarkGreen");
+ ColorWidget widget = (ColorWidget) manager.GetInstance<IWidget>("DarkGreen");
Assert.AreEqual("DarkGreen", widget.Color);
}
[Test]
public void AddInstanceAndOverrideTheConcreteTypeForADependency()
{
- IInstanceManager manager = new InstanceManager(delegate(Registry registry)
+ IContainer manager = new InstanceManager(delegate(Registry registry)
{
// Specify a new Instance that specifies the concrete type used for a dependency
registry.AddInstanceOf<Rule>().UsingConcreteType<WidgetRule>().WithName("AWidgetRule")
.Child<IWidget>().IsConcreteType<AWidget>();
});
- WidgetRule rule = (WidgetRule) manager.CreateInstance<Rule>("AWidgetRule");
+ WidgetRule rule = (WidgetRule) manager.GetInstance<Rule>("AWidgetRule");
Assert.IsInstanceOfType(typeof (AWidget), rule.Widget);
}
@@ -80,7 +80,7 @@
public void CreateAnInstancePullAPropertyFromTheApplicationConfig()
{
Assert.AreEqual("Blue", ConfigurationManager.AppSettings["Color"]);
- ColorWidget widget = (ColorWidget) manager.CreateInstance<IWidget>("AppSetting");
+ ColorWidget widget = (ColorWidget) manager.GetInstance<IWidget>("AppSetting");
Assert.AreEqual("Blue", widget.Color);
}
@@ -93,7 +93,7 @@
registry.AddInstanceOf<IWidget>().UsingConcreteType<AWidget>().WithName("MyInstance");
});
- AWidget widget = (AWidget) manager.CreateInstance<IWidget>("MyInstance");
+ AWidget widget = (AWidget) manager.GetInstance<IWidget>("MyInstance");
Assert.IsNotNull(widget);
}
@@ -115,9 +115,9 @@
.Child<IWidget>("widget").IsNamedInstance("Purple");
});
- Assert.IsInstanceOfType(typeof (ARule), manager.CreateInstance<Rule>("Alias"));
+ Assert.IsInstanceOfType(typeof (ARule), manager.GetInstance<Rule>("Alias"));
- WidgetRule rule = (WidgetRule) manager.CreateInstance<Rule>("RuleThatUsesMyInstance");
+ WidgetRule rule = (WidgetRule) manager.GetInstance<Rule>("RuleThatUsesMyInstance");
ColorWidget widget = (ColorWidget) rule.Widget;
Assert.AreEqual("Purple", widget.Color);
}
@@ -128,7 +128,7 @@
// Specify a new Instance, create an instance for a dependency on the fly
string instanceKey = "OrangeWidgetRule";
- IInstanceManager manager = new InstanceManager(delegate(Registry registry)
+ IContainer manager = new InstanceManager(delegate(Registry registry)
{
registry.AddInstanceOf<Rule>().UsingConcreteType<WidgetRule>().WithName(instanceKey)
.Child<IWidget>().Is(
@@ -139,7 +139,7 @@
});
- WidgetRule rule = (WidgetRule) manager.CreateInstance<Rule>(instanceKey);
+ WidgetRule rule = (WidgetRule) manager.GetInstance<Rule>(instanceKey);
ColorWidget widget = (ColorWidget) rule.Widget;
Assert.AreEqual("Orange", widget.Color);
}
@@ -157,9 +157,9 @@
registry.AddPrototypeInstanceOf<IWidget>(theWidget).WithName("Jeremy");
});
- CloneableWidget widget1 = (CloneableWidget) manager.CreateInstance<IWidget>("Jeremy");
- CloneableWidget widget2 = (CloneableWidget) manager.CreateInstance<IWidget>("Jeremy");
- CloneableWidget widget3 = (CloneableWidget) manager.CreateInstance<IWidget>("Jeremy");
+ CloneableWidget widget1 = (CloneableWidget) manager.GetInstance<IWidget>("Jeremy");
+ CloneableWidget widget2 = (CloneableWidget) manager.GetInstance<IWidget>("Jeremy");
+ CloneableWidget widget3 = (CloneableWidget) manager.GetInstance<IWidget>("Jeremy");
Assert.AreEqual("Jeremy", widget1.Name);
Assert.AreEqual("Jeremy", widget2.Name);
@@ -182,9 +182,9 @@
registry.AddInstanceOf<IWidget>(julia).WithName("Julia");
});
- CloneableWidget widget1 = (CloneableWidget) manager.CreateInstance<IWidget>("Julia");
- CloneableWidget widget2 = (CloneableWidget) manager.CreateInstance<IWidget>("Julia");
- CloneableWidget widget3 = (CloneableWidget) manager.CreateInstance<IWidget>("Julia");
+ CloneableWidget widget1 = (CloneableWidget) manager.GetInstance<IWidget>("Julia");
+ CloneableWidget widget2 = (CloneableWidget) manager.GetInstance<IWidget>("Julia");
+ CloneableWidget widget3 = (CloneableWidget) manager.GetInstance<IWidget>("Julia");
Assert.AreSame(julia, widget1);
Assert.AreSame(julia, widget2);
Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/AddTypesTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Configuration/DSL/AddTypesTester.cs 2008-05-28 03:35:02 UTC (rev 106)
+++ trunk/Source/StructureMap.Testing/Configuration/DSL/AddTypesTester.cs 2008-05-28 03:58:49 UTC (rev 107)
@@ -30,7 +30,7 @@
[Test]
public void A_concrete_type_is_available_by_name_when_it_is_added_by_the_shorthand_mechanism()
{
- IInstanceManager manager = new InstanceManager(delegate(Registry registry)
+ IContainer manager = new InstanceManager(delegate(Registry registry)
{
registry.ForRequestedType<IAddTypes>()
.AddConcreteType<RedAddTypes>("Red")
@@ -39,15 +39,15 @@
.AddConcreteType<PurpleAddTypes>();
});
- Assert.IsInstanceOfType(typeof (RedAddTypes), manager.CreateInstance<IAddTypes>("Red"));
- Assert.IsInstanceOfType(typeof (GreenAddTypes), manager.CreateInstance<IAddTypes>("Green"));
- Assert.IsInstanceOfType(typeof (BlueAddTypes), manager.CreateInstance<IAddTypes>("Blue"));
+ Assert.IsInstanceOfType(typeof (RedAddTypes), manager.GetInstance<IAddTypes>("Red"));
+ Assert.IsInstanceOfType(typeof (GreenAddTypes), manager.GetInstance<IAddTypes>("Green"));
+ Assert.IsInstanceOfType(typeof (BlueAddTypes), manager.GetInstance<IAddTypes>("Blue"));
}
[Test]
public void A_concrete_type_is_available_when_it_is_added_by_the_shorthand_mechanism()
{
- IInstanceManager manager = new InstanceManager(delegate(Registry registry)
+ IContainer manager = new InstanceManager(delegate(Registry registry)
{
registry.ForRequestedType<IAddTypes>()
.AddConcreteType<RedAddTypes>()
@@ -64,7 +64,7 @@
[Test]
public void Make_sure_that_we_dont_double_dip_instances_when_we_register_a_type_with_a_name()
{
- IInstanceManager manager = new InstanceManager(delegate(Registry registry)
+ IContainer manager = new InstanceManager(delegate(Registry registry)
{
registry.ForRequestedType<IAddTypes>()
.AddConcreteType<RedAddTypes>("Red")
Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/ConstructorExpressionTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Configuration/DSL/ConstructorExpressionTester.cs 2008-05-28 03:35:02 UTC (rev 106)
+++ trunk/Source/StructureMap.Testing/Configuration/DSL/ConstructorExpressionTester.cs 2008-05-28 03:58:49 UTC (rev 107)
@@ -31,7 +31,7 @@
Concretion concretion1 = new Concretion();
Concretion concretion2 = new Concretion();
- IInstanceManager manager = new InstanceManager(delegate(Registry registry)
+ IContainer manager = new InstanceManager(delegate(Registry registry)
{
registry.ForRequestedType<Abstraction>()
.AddInstances(
@@ -40,8 +40,8 @@
);
});
- Assert.AreSame(concretion1, manager.CreateInstance<Abstraction>("One"));
- Assert.AreSame(concretion2, manager.CreateInstance<Abstraction>("Two"));
+ Assert.AreSame(concretion1, manager.GetInstance<Abstraction>("One"));
+ Assert.AreSame(concretion2, manager.GetInstance<Abstraction>("Two"));
}
[Test]
@@ -49,14 +49,14 @@
{
Concretion concretion = new Concretion();
- IInstanceManager manager = new InstanceManager(delegate(Registry registry)
+ IContainer manager = new InstanceManager(delegate(Registry registry)
{
registry.ForRequestedType<Abstraction>().TheDefaultIs(
ConstructedBy<Abstraction>(delegate { return concretion; })
);
});
- Assert.AreSame(concretion, manager.CreateInstance<Abstraction>());
+ Assert.AreSame(concretion, manager.GetInstance<Abstraction>());
}
[Test]
@@ -65,7 +65,7 @@
Concretion concretion1 = new Concretion();
Concretion concretion2 = new Concretion();
- IInstanceManager manager = new InstanceManager(delegate(Registry registry)
+ IContainer manager = new InstanceManager(delegate(Registry registry)
{
registry.ForRequestedType<Abstraction>().AddInstance(
ConstructedBy<Abstraction>(delegate { return concretion1; }).WithName("One")
@@ -76,8 +76,8 @@
);
});
- Assert.AreSame(concretion1, manager.CreateInstance<Abstraction>("One"));
- Assert.AreSame(concretion2, manager.CreateInstance<Abstraction>("Two"));
+ Assert.AreSame(concretion1, manager.GetInstance<Abstraction>("One"));
+ Assert.AreSame(concretion2, manager.GetInstance<Abstraction>("Two"));
}
[Test]
@@ -85,7 +85,7 @@
{
Concretion concretion = new Concretion();
- IInstanceManager manager = new InstanceManager(delegate(Registry registry)
+ IContainer manager = new InstanceManager(delegate(Registry registry)
{
registry.ForRequestedType<Abstraction>().AddInstance(
ConstructedBy<Abstraction>(delegate { return concretion; })
Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs 2008-05-28 03:35:02 UTC (rev 106)
+++ trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs 2008-05-28 03:58:49 UTC (rev 107)
@@ -60,7 +60,7 @@
[Test]
public void AddInstanceByNameOnlyAddsOneInstanceToStructureMap()
{
- IInstanceManager manager = new InstanceManager(delegate(Registry registry)
+ IContainer manager = new InstanceManager(delegate(Registry registry)
{
registry.ForRequestedType<Something>().AddInstance(
RegistryExpressions.Instance<Something>().UsingConcreteType<RedSomething>().WithName("Red")
@@ -73,7 +73,7 @@
[Test]
public void AddInstanceWithNameOnlyAddsOneInstanceToStructureMap()
{
- IInstanceManager manager = new InstanceManager(delegate(Registry registry)
+ IContainer manager = new InstanceManager(delegate(Registry registry)
{
registry.AddInstanceOf<Something>().UsingConcreteType<RedSomething>().WithName("Red");
});
@@ -144,7 +144,7 @@
Assert.IsTrue(pluginGraph.ContainsFamily(typeof (IGateway)));
InstanceManager manager = new InstanceManager(pluginGraph);
- IGateway gateway = (IGateway) manager.CreateInstance(typeof (IGateway));
+ IGateway gateway = (IGateway) manager.GetInstance(typeof (IGateway));
Assert.IsInstanceOfType(typeof (StubbedGateway), gateway);
}
@@ -159,7 +159,7 @@
Assert.IsTrue(pluginGraph.ContainsFamily(typeof (IGateway)));
InstanceManager manager = new InstanceManager(pluginGraph);
- IGateway gateway = (IGateway) manager.CreateInstance(typeof (IGateway));
+ IGateway gateway = (IGateway) manager.GetInstance(typeof (IGateway));
Assert.IsInstanceOfType(typeof (FakeGateway), gateway);
}
@@ -167,7 +167,7 @@
[Test]
public void CreatePluginFamilyWithADefault()
{
- IInstanceManager manager = new InstanceManager(delegate(Registry registry)
+ IContainer manager = new InstanceManager(delegate(Registry registry)
{
registry.BuildInstancesOf<IWidget>().TheDefaultIs(
RegistryExpressions.Instance<IWidget>().UsingConcreteType<ColorWidget>().WithProperty("Color").EqualTo(
@@ -175,7 +175,7 @@
);
});
- ColorWidget widget = (ColorWidget) manager.CreateInstance<IWidget>();
+ ColorWidget widget = (ColorWidget) manager.GetInstance<IWidget>();
Assert.AreEqual("Red", widget.Color);
}
@@ -199,7 +199,7 @@
new InstanceManager(
delegate(Registry registry) { registry.ForRequestedType<IWidget>().TheDefaultIs(delegate { return new AWidget(); }); });
- Assert.IsInstanceOfType(typeof (AWidget), manager.CreateInstance<IWidget>());
+ Assert.IsInstanceOfType(typeof (AWidget), manager.GetInstance<IWidget>());
}
[Test]
@@ -211,19 +211,19 @@
new InstanceManager(
delegate(Registry registry) { registry.ForRequestedType<IWidget>().TheDefaultIs(aWidget); });
- Assert.AreSame(aWidget, manager.CreateInstance<IWidget>());
+ Assert.AreSame(aWidget, manager.GetInstance<IWidget>());
}
[Test]
public void TheDefaultInstanceIsConcreteType()
{
- IInstanceManager manager = new InstanceManager(delegate(Registry registry)
+ IContainer manager = new InstanceManager(delegate(Registry registry)
{
// Needs to blow up if the concrete type can't be used
registry.BuildInstancesOf<Rule>().TheDefaultIsConcreteType<ARule>();
});
- Assert.IsInstanceOfType(typeof (ARule), manager.CreateInstance<Rule>());
+ Assert.IsInstanceOfType(typeof (ARule), manager.GetInstance<Rule>());
}
[Test]
@@ -238,7 +238,7 @@
Assert.IsTrue(pluginGraph.ContainsFamily(typeof (IGateway)));
InstanceManager manager = new InstanceManager(pluginGraph);
- IGateway gateway = (IGateway) manager.CreateInstance(typeof (IGateway));
+ IGateway gateway = (IGateway) manager.GetInstance(typeof (IGateway));
Assert.IsInstanceOfType(typeof (DefaultGateway), gateway);
}
Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/DeepInstanceTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Configuration/DSL/DeepInstanceTester.cs 2008-05-28 03:35:02 UTC (rev 106)
+++ trunk/Source/StructureMap.Testing/Configuration/DSL/DeepInstanceTester.cs 2008-05-28 03:58:49 UTC (rev 107)
@@ -12,8 +12,8 @@
private void assertThingMatches(Action<Registry> action)
{
- IInstanceManager manager = new InstanceManager(action);
- Thing actual = manager.CreateInstance<Thing>();
+ IContainer manager = new InstanceManager(action);
+ Thing actual = manager.GetInstance<Thing>();
Assert.AreEqual(_prototype, actual);
}
Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/GenericFamilyExpressionTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Configuration/DSL/GenericFamilyExpressionTester.cs 2008-05-28 03:35:02 UTC (rev 106)
+++ trunk/Source/StructureMap.Testing/Configuration/DSL/GenericFamilyExpressionTester.cs 2008-05-28 03:58:49 UTC (rev 107)
@@ -65,9 +65,9 @@
});
- Assert.IsInstanceOfType(typeof(Target1), manager.CreateInstance<ITarget>("1"));
- Assert.IsInstanceOfType(typeof(Target2), manager.CreateInstance<ITarget>("2"));
- Assert.IsInstanceOfType(typeof(Target3), manager.CreateInstance<ITarget>("3"));
+ Assert.IsInstanceOfType(typeof(Target1), manager.GetInstance<ITarget>("1"));
+ Assert.IsInstanceOfType(typeof(Target2), manager.GetInstance<ITarget>("2"));
+ Assert.IsInstanceOfType(typeof(Target3), manager.GetInstance<ITarget>("3"));
}
[Test]
@@ -78,7 +78,7 @@
r.ForRequestedType(typeof (ITarget)).TheDefaultIsConcreteType(typeof (Target3));
});
- Assert.IsInstanceOfType(typeof(Target3), manager.CreateInstance<ITarget>());
+ Assert.IsInstanceOfType(typeof(Target3), manager.GetInstance<ITarget>());
}
[Test]
@@ -89,7 +89,7 @@
r.ForRequestedType(typeof(ITarget)).TheDefaultIs(Instance<Target2>());
});
- Assert.IsInstanceOfType(typeof(Target2), manager.CreateInstance<ITarget>());
+ Assert.IsInstanceOfType(typeof(Target2), manager.GetInstance<ITarget>());
}
[Test]
@@ -100,7 +100,7 @@
r.ForRequestedType(typeof(ITarget)).TheDefaultIs(delegate() { return new Target1(); });
});
- Assert.IsInstanceOfType(typeof(Target1), manager.CreateInstance<ITarget>());
+ Assert.IsInstanceOfType(typeof(Target1), manager.GetInstance<ITarget>());
}
[Test]
@@ -125,7 +125,7 @@
.EnrichWith(delegate(object raw){ return new WrappedTarget((ITarget) raw);});
});
- WrappedTarget target = (WrappedTarget) manager.CreateInstance<ITarget>();
+ WrappedTarget target = (WrappedTarget) manager.GetInstance<ITarget>();
Assert.IsInstanceOfType(typeof(Target1), target.Inner);
}
@@ -171,7 +171,7 @@
.OnCreation(delegate(object raw) { created = (ITarget) raw; });
});
- manager.CreateInstance<ITarget>();
+ manager.GetInstance<ITarget>();
Assert.IsInstanceOfType(typeof(Target3), created);
}
Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/InjectArrayTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Configuration/DSL/InjectArrayTester.cs 2008-05-28 03:35:02 UTC (rev 106)
+++ trunk/Source/StructureMap.Testing/Configuration/DSL/InjectArrayTester.cs 2008-05-28 03:58:49 UTC (rev 107)
@@ -82,7 +82,7 @@
[Test]
public void CanStillAddOtherPropertiesAfterTheCallToChildArray()
{
- IInstanceManager manager = new InstanceManager(delegate(Registry registry)
+ IContainer manager = new InstanceManager(delegate(Registry registry)
{
registry.ForRequestedType<Processor>()
.TheDefaultIs(
@@ -96,14 +96,14 @@
);
});
- Processor processor = manager.CreateInstance<Processor>();
+ Processor processor = manager.GetInstance<Processor>();
Assert.AreEqual("Jeremy", processor.Name);
}
[Test]
public void InjectPropertiesByName()
{
- IInstanceManager manager = new InstanceManager(delegate(Registry registry)
+ IContainer manager = new InstanceManager(delegate(Registry registry)
{
registry.ForRequestedType<Processor2>()
.TheDefaultIs(
@@ -120,7 +120,7 @@
});
- Processor2 processor = manager.CreateInstance<Processor2>();
+ Processor2 processor = manager.GetInstance<Processor2>();
Assert.IsInstanceOfType(typeof (Handler1), processor.First[0]);
Assert.IsInstanceOfType(typeof (Handler2), processor.First[1]);
@@ -153,7 +153,7 @@
[Test]
public void PlaceMemberInArrayByReference()
{
- IInstanceManager manager = new InstanceManager(delegate(Registry registry)
+ IContainer manager = new InstanceManager(delegate(Registry registry)
{
registry.AddInstanceOf<IHandler>().UsingConcreteType<Handler1>().WithName("One");
registry.AddInstanceOf<IHandler>().UsingConcreteType<Handler2>().WithName("Two");
@@ -169,7 +169,7 @@
);
});
- Processor processor = manager.CreateInstance<Processor>();
+ Processor processor = manager.GetInstance<Processor>();
Assert.IsInstanceOfType(typeof (Handler2), processor.Handlers[0]);
Assert.IsInstanceOfType(typeof (Handler1), processor.Handlers[1]);
@@ -178,7 +178,7 @@
[Test]
public void ProgrammaticallyInjectArrayAllInline()
{
- IInstanceManager manager = new InstanceManager(delegate(Registry registry)
+ IContainer manager = new InstanceManager(delegate(Registry registry)
{
registry.ForRequestedType<Processor>()
.TheDefaultIs(
@@ -192,7 +192,7 @@
);
});
- Processor processor = manager.CreateInstance<Processor>();
+ Processor processor = manager.GetInstance<Processor>();
Assert.IsInstanceOfType(typeof (Handler1), processor.Handlers[0]);
Assert.IsInstanceOfType(typeof (Handler2), processor.Handlers[1]);
Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/InterceptAllInstancesOfPluginTypeTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Configuration/DSL/InterceptAllInstancesOfPluginTypeTester.cs 2008-05-28 03:35:02 UTC (rev 106)
+++ trunk/Source/StructureMap.Testing/Configuration/DSL/InterceptAllInstancesOfPluginTypeTester.cs 2008-05-28 03:58:49 UTC (rev 107)
@@ -31,7 +31,7 @@
#endregion
private IService _lastService;
- private IInstanceManager _manager;
+ private IContainer _manager;
private Action<Registry> _defaultRegistry;
private IService getService(Action<Registry> action, string name)
@@ -45,7 +45,7 @@
});
}
- return _manager.CreateInstance<IService>(name);
+ return _manager.GetInstance<IService>(name);
}
[Test]
Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/InterceptorTesting.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Configuration/DSL/InterceptorTesting.cs 2008-05-28 03:35:02 UTC (rev 106)
+++ trunk/Source/StructureMap.Testing/Configuration/DSL/InterceptorTesting.cs 2008-05-28 03:58:49 UTC (rev 107)
@@ -47,12 +47,12 @@
private ColorService _lastService;
- private IInstanceManager _manager;
+ private IContainer _manager;
[Test]
public void DecorateAConstructedService()
{
- IService service = _manager.CreateInstance<IService>("Purple");
+ IService service = _manager.GetInstance<IService>("Purple");
DecoratorService decoratorService = (DecoratorService) service;
ColorService innerService = (ColorService) decoratorService.Inner;
@@ -62,7 +62,7 @@
[Test]
public void DecorateInline()
{
- IService service = _manager.CreateInstance<IService>("Decorated");
+ IService service = _manager.GetInstance<IService>("Decorated");
DecoratorService decoratorService = (DecoratorService) service;
ColorService innerService = (ColorService) decoratorService.Inner;
@@ -74,7 +74,7 @@
public void OnCreationWithAConstructedService()
{
Assert.IsNull(_lastService);
- IService interceptedService = _manager.CreateInstance<IService>("Yellow");
+ IService interceptedService = _manager.GetInstance<IService>("Yellow");
Assert.AreSame(_lastService, interceptedService);
}
@@ -85,10 +85,10 @@
// "NotIntercepted" should not.
Assert.IsNull(_lastService);
- _manager.CreateInstance<IService>("NotIntercepted");
+ _manager.GetInstance<IService>("NotIntercepted");
Assert.IsNull(_lastService);
- IService interceptedService = _manager.CreateInstance<IService>("Intercepted");
+ IService interceptedService = _manager.GetInstance<IService>("Intercepted");
Assert.AreSame(_lastService, interceptedService);
}
@@ -97,7 +97,7 @@
{
try
{
- _manager.CreateInstance<IService>("Bad");
+ _manager.GetInstance<IService>("Bad");
Assert.Fail("Should have thrown an error");
}
catch (StructureMapException e)
Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/ProfileExpressionTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Configuration/DSL/ProfileExpressionTester.cs 2008-05-28 03:35:02 UTC (rev 106)
+++ trunk/Source/StructureMap.Testing/Configuration/DSL/ProfileExpressionTester.cs 2008-05-28 03:58:49 UTC (rev 107)
@@ -58,7 +58,7 @@
InstanceManager manager = new InstanceManager(graph);
manager.SetDefaultsToProfile(theProfileName);
- AWidget widget = (AWidget)manager.CreateInstance<IWidget>();
+ AWidget widget = (AWidget)manager.GetInstance<IWidget>();
Assert.IsNotNull(widget);
}
@@ -83,7 +83,7 @@
{
string theProfileName = "something";
- IInstanceManager manager = new InstanceManager(delegate(Registry registry)
+ IContainer manager = new InstanceManager(delegate(Registry registry)
{
registry.CreateProfile(theProfileName)
.For<IWidget>().UseConcreteType<AWidget>()
@@ -91,8 +91,8 @@
});
manager.SetDefaultsToProfile(theProfileName);
- Assert.IsInstanceOfType(typeof(AWidget), manager.CreateInstance<IWidget>());
- Assert.IsInstanceOfType(typeof(DefaultRule), manager.CreateInstance<Rule>());
+ Assert.IsInstanceOfType(typeof(AWidget), manager.GetInstance<IWidget>());
+ Assert.IsInstanceOfType(typeof(DefaultRule), manager.GetInstance<Rule>());
}
@@ -101,7 +101,7 @@
{
string theProfileName = "something";
- IInstanceManager manager = new InstanceManager(delegate(Registry registry)
+ IContainer manager = new InstanceManager(delegate(Registry registry)
{
registry.CreateProfile(theProfileName)
.For<IWidget>().Use(delegate() { return new AWidget(); })
@@ -112,8 +112,8 @@
manager.SetDefaultsToProfile(theProfileName);
- Assert.IsInstanceOfType(typeof(AWidget), manager.CreateInstance<IWidget>());
- Assert.IsInstanceOfType(typeof(DefaultRule), manager.CreateInstance<Rule>());
+ Assert.IsInstanceOfType(typeof(AWidget), manager.GetInstance<IWidget>());
+ Assert.IsInstanceOfType(typeof(DefaultRule), manager.GetInstance<Rule>());
}
[Test]
@@ -122,7 +122,7 @@
string theProfileName = "something";
IWidget theTemplate = new AWidget();
- IInstanceManager manager = new InstanceManager(delegate(Registry registry)
+ IContainer manager = new InstanceManager(delegate(Registry registry)
{
registry.CreateProfile(theProfileName)
.For<IWidget>().UsePrototypeOf(theTemplate);
@@ -130,8 +130,8 @@
manager.SetDefaultsToProfile(theProfileName);
- IWidget widget1 = manager.CreateInstance<IWidget>();
- IWidget widget2 = manager.CreateInstance<IWidget>();
+ IWidget widget1 = manager.GetInstance<IWidget>();
+ IWidget widget2 = manager.GetInstance<IWidget>();
Assert.IsNotNull(widget1);
Assert.IsNotNull(widget2);
Modified: trunk/Source/StructureMap.Testing/Configuration/DefaultInstanceNodeTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Configuration/DefaultInstanceNodeTester.cs 2008-05-28 03:35:02 UTC (rev 106)
+++ trunk/Source/StructureMap.Testing/Configuration/DefaultInstanceNodeTester.cs 2008-05-28 03:58:49 UTC (rev 107)
@@ -39,20 +39,20 @@
[Test]
public void GetTheRule()
{
- ColorRule rule = (ColorRule) _manager.CreateInstance<Rule>();
+ ColorRule rule = (ColorRule) _manager.GetInstance<Rule>();
Assert.AreEqual("Blue", rule.Color);
- ColorRule rule2 = (ColorRule) _manager.CreateInstance<Rule>();
+ ColorRule rule2 = (ColorRule) _manager.GetInstance<Rule>();
Assert.AreSame(rule, rule2);
}
[Test]
public void GetTheWidget()
{
- ColorWidget widget = (ColorWidget) _manager.CreateInstance<IWidget>();
+ ColorWidget widget = (ColorWidget) _manager.GetInstance<IWidget>();
Assert.AreEqual("Red", widget.Color);
- ColorWidget widget2 = (ColorWidget) _manager.CreateInstance<IWidget>();
+ ColorWidget widget2 = (ColorWidget) _manager.GetInstance<IWidget>();
Assert.AreNotSame(widget, widget2);
}
}
Modified: trunk/Source/StructureMap.Testing/Configuration/InlineInstanceDefinitionInProfileAndMachineNodesTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Configuration/InlineInstanceDefinitionInProfileAndMachineNodesTester.cs 2008-05-28 03:35:02 UTC (rev 106)
+++ trunk/Source/StructureMap.Testing/Configuration/InlineInstanceDefinitionInProfileAndMachineNodesTester.cs 2008-05-28 03:58:49 UTC (rev 107)
@@ -87,7 +87,7 @@
ProfileBuilder.OverrideMachineName("GREEN-BOX");
InstanceManager manager = new InstanceManager(graph);
- ColorWidget widget = (ColorWidget) manager.CreateInstance<IWidget>();
+ ColorWidget widget = (ColorWidget) manager.GetInstance<IWidget>();
Assert.AreEqual("Green", widget.Color);
}
@@ -97,7 +97,7 @@
ProfileBuilder.OverrideMachineName("ORANGE-BOX");
InstanceManager manager = new InstanceManager(graph);
- ColorWidget widget = (ColorWidget)manager.CreateInstance<IWidget>();
+ ColorWidget widget = (ColorWidget)manager.GetInstance<IWidget>();
Assert.AreEqual("Orange", widget.Color);
}
@@ -108,7 +108,7 @@
manager.SetDefaultsToProfile("Green");
- ColorWidget widget = (ColorWidget)manager.CreateInstance<IWidget>();
+ ColorWidget widget = (ColorWidget)manager.GetInstance<IWidget>();
Assert.AreEqual("Green", widget.Color);
}
@@ -118,10 +118,10 @@
InstanceManager manager = new InstanceManager(graph);
manager.SetDefaultsToProfile("Blue");
- ColorRule rule = (ColorRule) manager.CreateInstance<Rule>();
+ ColorRule rule = (ColorRule) manager.GetInstance<Rule>();
Assert.AreEqual("Blue", rule.Color);
- ColorWidget widget = (ColorWidget) manager.CreateInstance<IWidget>();
+ ColorWidget widget = (ColorWidget) manager.GetInstance<IWidget>();
Assert.AreEqual("Blue", widget.Color);
}
@@ -133,7 +133,7 @@
ProfileBuilder.OverrideMachineName("ORANGE-BOX");
InstanceManager manager = new InstanceManager(graph);
- ColorWidget widget = (ColorWidget)manager.CreateInstance(typeof(IWidget));
+ ColorWidget widget = (ColorWidget)manager.GetInstance(typeof(IWidget));
Assert.AreEqual("Orange", widget.Color);
}
@@ -143,7 +143,7 @@
ProfileBuilder.OverrideMachineName("GREEN-BOX");
InstanceManager manager = new InstanceManager(graph);
- ColorWidget widget = (ColorWidget)manager.CreateInstance(typeof(IWidget));
+ ColorWidget widget = (ColorWidget)manager.GetInstance(typeof(IWidget));
Assert.AreEqual("Green", widget.Color);
}
@@ -153,12 +153,12 @@
InstanceManager manager = new InstanceManager(graph);
manager.SetDefaultsToProfile("Green");
- ColorRule greenRule = (ColorRule)manager.CreateInstance(typeof(Rule));
+ ColorRule greenRule = (ColorRule)manager.GetInstance(typeof(Rule));
Assert.AreEqual("Green", greenRule.Color);
manager.SetDefaultsToProfile("Blue");
- ColorRule blueRule = (ColorRule)manager.CreateInstance(typeof(Rule));
+ ColorRule blueRule = (ColorRule)manager.GetInstance(typeof(Rule));
Assert.AreEqual("Blue", blueRule.Color);
}
}
Modified: trunk/Source/StructureMap.Testing/Configuration/ShortcuttedInstanceNodeTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Configuration/ShortcuttedInstanceNodeTester.cs 2008-05-28 03:35:02 UTC (rev 106)
+++ trunk/Source/StructureMap.Testing/Configuration/ShortcuttedInstanceNodeTester.cs 2008-05-28 03:58:49 UTC (rev 107)
@@ -49,17 +49,17 @@
[Test]
public void GetTheRule()
{
- ColorRule rule = (ColorRule) _manager.CreateInstance<Rule>("Blue");
+ ColorRule rule = (ColorRule) _manager.GetInstance<Rule>("Blue");
...
[truncated message content] |