|
From: <jer...@us...> - 2008-04-12 13:45:11
|
Revision: 80
http://structuremap.svn.sourceforge.net/structuremap/?rev=80&view=rev
Author: jeremydmiller
Date: 2008-04-12 06:45:08 -0700 (Sat, 12 Apr 2008)
Log Message:
-----------
fixing generics tests
Modified Paths:
--------------
trunk/Source/StructureMap/Graph/PluginFamily.cs
trunk/Source/StructureMap/Pipeline/ConfiguredInstance.cs
trunk/Source/StructureMap/Pipeline/Instance.cs
trunk/Source/StructureMap/Properties/AssemblyInfo.cs
trunk/Source/StructureMap.Testing/AlternativeConfigurationTester.cs
trunk/Source/StructureMap.Testing/Container/InstanceManagerTester.cs
trunk/Source/StructureMap.Testing/GenericsAcceptanceTester.cs
trunk/Source/StructureMap.Testing/GenericsIntegrationTester.cs
trunk/Source/StructureMap.Testing/Graph/GenericsPluginGraphTester.cs
trunk/Source/StructureMap.Testing/Pipeline/ConfiguredInstanceTester.cs
trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj
trunk/Source/StructureMap.Testing/StructureMapConfigurationTester.cs
trunk/Source/StructureMap.Testing.GenericWidgets/StructureMap.Testing.GenericWidgets.csproj
Removed Paths:
-------------
trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildArrayExpression.cs
trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildInstanceExpression.cs
trunk/Source/StructureMap/Configuration/DSL/Expressions/ConstructorExpression.cs
trunk/Source/StructureMap/Configuration/DSL/Expressions/IMementoBuilder.cs
trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceExpression.cs
trunk/Source/StructureMap/Configuration/DSL/Expressions/LiteralExpression.cs
trunk/Source/StructureMap/Configuration/DSL/Expressions/MementoBuilder.cs
trunk/Source/StructureMap/Configuration/DSL/Expressions/PropertyExpression.cs
trunk/Source/StructureMap/Configuration/DSL/Expressions/PrototypeExpression.cs
trunk/Source/StructureMap/Configuration/DSL/Expressions/UserControlExpression.cs
trunk/Source/StructureMap/Configuration/DSL/ReferenceMementoBuilder.cs
trunk/Source/StructureMap/Configuration/Mementos/ExplicitArgumentMemento.cs
trunk/Source/StructureMap/ConstructorMemento.cs
trunk/Source/StructureMap/Graph/DefinitionSource.cs
trunk/Source/StructureMap/Graph/Deployable.cs
trunk/Source/StructureMap/Graph/PluginGraphObjectCollection.cs
trunk/Source/StructureMap/IInstanceCreator.cs
trunk/Source/StructureMap.Testing/Configuration/DSL/ChildInstanceExpressionTester.cs
trunk/Source/StructureMap.Testing/Configuration/DSL/LiteralExpressionTester.cs
trunk/Source/StructureMap.Testing/Configuration/DSL/ReferenceMementoBuilderTester.cs
trunk/Source/StructureMap.Testing/Configuration/DSL/UserControlExpressionTester.cs
trunk/Source/StructureMap.Testing/ConstructorMementoTester.cs
trunk/Source/StructureMap.Testing/Graph/GraphDeploymentTester.cs
trunk/Source/StructureMap.Testing/InstanceMementoTester.cs
Deleted: trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildArrayExpression.cs
===================================================================
--- trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildArrayExpression.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildArrayExpression.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -1,55 +0,0 @@
-using System;
-using StructureMap.Configuration.Mementos;
-using StructureMap.Graph;
-
-namespace StructureMap.Configuration.DSL.Expressions
-{
- public class ChildArrayExpression<PLUGINTYPE> : IExpression
- {
- private readonly MemoryInstanceMemento _memento;
- private readonly InstanceExpression _parent;
- 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();
- }
-
- #region IExpression Members
-
- 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);
- }
-
- #endregion
-
- 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
Deleted: trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildInstanceExpression.cs
===================================================================
--- trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildInstanceExpression.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildInstanceExpression.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -1,120 +0,0 @@
-using System;
-using System.Collections.Generic;
-using StructureMap.Configuration.Mementos;
-using StructureMap.Graph;
-
-namespace StructureMap.Configuration.DSL.Expressions
-{
- /// <summary>
- /// Part of the Fluent Interface, represents a nonprimitive argument to a
- /// constructure function
- /// </summary>
- public class ChildInstanceExpression : IExpression
- {
- private readonly InstanceExpression _instance;
- private readonly MemoryInstanceMemento _memento;
- private readonly string _propertyName;
- private IMementoBuilder _builder;
- private List<IExpression> _children = new List<IExpression>();
- private Type _childType;
-
-
- public ChildInstanceExpression(InstanceExpression instance, MemoryInstanceMemento memento, string propertyName)
- {
- _instance = instance;
- _memento = memento;
- _propertyName = propertyName;
- }
-
- public ChildInstanceExpression(InstanceExpression instance, MemoryInstanceMemento memento, string propertyName,
- Type childType)
- : this(instance, memento, propertyName)
- {
- _childType = childType;
- }
-
- internal Type ChildType
- {
- set { _childType = value; }
- }
-
- #region IExpression Members
-
- void IExpression.Configure(PluginGraph graph)
- {
- if (_childType == null)
- {
- return;
- }
-
- PluginFamily family = graph.LocateOrCreateFamilyForType(_childType);
- if (_builder != null)
- {
- InstanceMemento childMemento = _builder.BuildMemento(family);
- _memento.AddChild(_propertyName, childMemento);
- }
-
- foreach (IExpression child in _children)
- {
- child.Configure(graph);
- }
- }
-
- #endregion
-
- /// <summary>
- /// Use a previously configured and named instance for the child
- /// </summary>
- /// <param name="instanceKey"></param>
- /// <returns></returns>
- public InstanceExpression IsNamedInstance(string instanceKey)
- {
- MemoryInstanceMemento child = MemoryInstanceMemento.CreateReferencedInstanceMemento(instanceKey);
- _memento.AddChild(_propertyName, child);
-
- return _instance;
- }
-
- /// <summary>
- /// Start the definition of a child instance by defining the concrete type
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <returns></returns>
- public InstanceExpression IsConcreteType<T>()
- {
- Type pluggedType = typeof (T);
- ExpressionValidator.ValidatePluggabilityOf(pluggedType).IntoPluginType(_childType);
-
-
- InstanceExpression child = new InstanceExpression(_childType);
- child.TypeExpression().UsingConcreteType<T>();
- _children.Add(child);
-
- _builder = child;
-
- return _instance;
- }
-
-
- /// <summary>
- /// Registers a configured instance to use as the argument to the parent's
- /// constructor
- /// </summary>
- /// <param name="child"></param>
- /// <returns></returns>
- public InstanceExpression Is(InstanceExpression child)
- {
- if (child.PluggedType != null && _childType != null)
- {
- ExpressionValidator.ValidatePluggabilityOf(child.PluggedType).IntoPluginType(_childType);
- }
-
- _children.Add(child);
- MemoryInstanceMemento childMemento =
- MemoryInstanceMemento.CreateReferencedInstanceMemento(child.InstanceKey);
- _memento.AddChild(_propertyName, childMemento);
-
- return _instance;
- }
- }
-}
\ No newline at end of file
Deleted: trunk/Source/StructureMap/Configuration/DSL/Expressions/ConstructorExpression.cs
===================================================================
--- trunk/Source/StructureMap/Configuration/DSL/Expressions/ConstructorExpression.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap/Configuration/DSL/Expressions/ConstructorExpression.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -1,49 +0,0 @@
-using System;
-using StructureMap.Graph;
-
-namespace StructureMap.Configuration.DSL.Expressions
-{
- public class ConstructorExpression<PLUGINTYPE> : MementoBuilder<ConstructorExpression<PLUGINTYPE>>
- {
- private ConstructorMemento<PLUGINTYPE> _memento;
-
- public ConstructorExpression(BuildObjectDelegate<PLUGINTYPE> builder)
- : base(typeof (PLUGINTYPE))
- {
- _memento.Builder = builder;
- }
-
-
- protected override InstanceMemento memento
- {
- get { return _memento; }
- }
-
- protected override ConstructorExpression<PLUGINTYPE> thisInstance
- {
- get { return this; }
- }
-
- protected override void configureMemento(PluginFamily family)
- {
- }
-
- protected override void validate()
- {
- }
-
- protected override void buildMemento()
- {
- _memento = new ConstructorMemento<PLUGINTYPE>();
- }
-
- public override void ValidatePluggability(Type pluginType)
- {
- if (!pluginType.Equals(typeof (PLUGINTYPE)))
- {
- throw new StructureMapException(306,
- typeof (PLUGINTYPE).FullName, pluginType.FullName);
- }
- }
- }
-}
\ No newline at end of file
Deleted: trunk/Source/StructureMap/Configuration/DSL/Expressions/IMementoBuilder.cs
===================================================================
--- trunk/Source/StructureMap/Configuration/DSL/Expressions/IMementoBuilder.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap/Configuration/DSL/Expressions/IMementoBuilder.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -1,14 +0,0 @@
-using System;
-using StructureMap.Graph;
-
-namespace StructureMap.Configuration.DSL.Expressions
-{
- public interface IMementoBuilder : IExpression
- {
- InstanceMemento BuildMemento(PluginFamily family);
- InstanceMemento BuildMemento(PluginGraph graph);
- void SetInstanceName(string instanceKey);
-
- void ValidatePluggability(Type pluginType);
- }
-}
\ No newline at end of file
Deleted: trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceExpression.cs
===================================================================
--- trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceExpression.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceExpression.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -1,197 +0,0 @@
-using System;
-using StructureMap.Configuration.Mementos;
-using StructureMap.Graph;
-
-namespace StructureMap.Configuration.DSL.Expressions
-{
- /// <summary>
- /// Used to define an Instance in code
- /// </summary>
- public class InstanceExpression : MementoBuilder<InstanceExpression>
- {
- private MemoryInstanceMemento _memento;
- private Type _pluggedType;
-
- public InstanceExpression(Type pluginType) : base(pluginType)
- {
- }
-
-
- internal Type PluggedType
- {
- get { return _pluggedType; }
- }
-
-
- protected override InstanceMemento memento
- {
- get { return _memento; }
- }
-
- protected override InstanceExpression thisInstance
- {
- get { return this; }
- }
-
- protected override void buildMemento()
- {
- _memento = new MemoryInstanceMemento();
- }
-
- protected override void configureMemento(PluginFamily family)
- {
- Plugin plugin = _pluggedType == null
- ? family.Plugins[_memento.ConcreteKey]
- : family.Plugins.FindOrCreate(_pluggedType, false);
-
- _memento.ConcreteKey = plugin.ConcreteKey;
- }
-
- protected override void validate()
- {
- if (_pluggedType == null && string.IsNullOrEmpty(_memento.ConcreteKey))
- {
- throw new StructureMapException(301, _memento.InstanceKey,
- TypePath.GetAssemblyQualifiedName(_pluginType));
- }
- }
-
-
- /// <summary>
- /// Start the definition of a primitive argument to a constructor argument
- /// </summary>
- /// <param name="propertyName"></param>
- /// <returns></returns>
- public PropertyExpression WithProperty(string propertyName)
- {
- return new PropertyExpression(this, _memento, propertyName);
- }
-
- /// <summary>
- /// Starts the definition of a child instance specifying the argument name
- /// in the case of a constructor function that consumes more than one argument
- /// of type T
- /// </summary>
- /// <typeparam name="CONSTRUCTORARGUMENTTYPE"></typeparam>
- /// <param name="propertyName"></param>
- /// <returns></returns>
- public ChildInstanceExpression Child<CONSTRUCTORARGUMENTTYPE>(string propertyName)
- {
- ChildInstanceExpression child = new ChildInstanceExpression(this, _memento, propertyName);
- addChildExpression(child);
- child.ChildType = typeof (CONSTRUCTORARGUMENTTYPE);
-
- return child;
- }
-
- /// <summary>
- /// Start the definition of a child instance for type CONSTRUCTORARGUMENTTYPE
- /// </summary>
- /// <typeparam name="CONSTRUCTORARGUMENTTYPE"></typeparam>
- /// <returns></returns>
- public ChildInstanceExpression Child<CONSTRUCTORARGUMENTTYPE>()
- {
- string propertyName = findPropertyName<CONSTRUCTORARGUMENTTYPE>();
-
- ChildInstanceExpression child = new ChildInstanceExpression(this, _memento, propertyName);
- addChildExpression(child);
- child.ChildType = typeof (CONSTRUCTORARGUMENTTYPE);
- return child;
- }
-
- private string findPropertyName<T>()
- {
- Plugin plugin = Plugin.CreateImplicitPlugin(_pluggedType);
- 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)
- {
- if (_pluggedType == null)
- {
- return;
- }
-
- ExpressionValidator.ValidatePluggabilityOf(_pluggedType).IntoPluginType(pluginType);
- }
-
- internal InstanceTypeExpression TypeExpression()
- {
- return new InstanceTypeExpression(this);
- }
-
- 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);
- }
- }
-
- #region Nested type: InstanceTypeExpression
-
- /// <summary>
- /// Helper class to capture the actual concrete type of an Instance
- /// </summary>
- public class InstanceTypeExpression
- {
- private readonly InstanceExpression _parent;
-
- internal InstanceTypeExpression(InstanceExpression parent)
- {
- _parent = parent;
- }
-
- /// <summary>
- /// Use type T for the concrete type of an instance
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <returns></returns>
- public InstanceExpression UsingConcreteType<T>()
- {
- _parent._pluggedType = typeof (T);
- _parent._memento.InstanceKey = typeof (T).Name;
- return _parent;
- }
-
- /// <summary>
- /// Use a named Plugin type denoted by a [Pluggable("Key")] attribute
- /// </summary>
- /// <param name="concreteKey"></param>
- /// <returns></returns>
- public InstanceExpression UsingConcreteTypeNamed(string concreteKey)
- {
- _parent._memento.ConcreteKey = concreteKey;
- return _parent;
- }
- }
-
- #endregion
- }
-}
\ No newline at end of file
Deleted: trunk/Source/StructureMap/Configuration/DSL/Expressions/LiteralExpression.cs
===================================================================
--- trunk/Source/StructureMap/Configuration/DSL/Expressions/LiteralExpression.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap/Configuration/DSL/Expressions/LiteralExpression.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -1,51 +0,0 @@
-using System;
-using StructureMap.Configuration.Mementos;
-using StructureMap.Graph;
-
-namespace StructureMap.Configuration.DSL.Expressions
-{
- /// <summary>
- /// Small helper class to represent an object to be plugged into a PluginType as is
- /// </summary>
- /// <typeparam name="T"></typeparam>
- public class LiteralExpression<T> : MementoBuilder<LiteralExpression<T>>
- {
- private readonly T _target;
- private LiteralMemento _memento;
-
- public LiteralExpression(T target) : base(typeof (T))
- {
- _target = target;
- }
-
-
- protected override InstanceMemento memento
- {
- get { return _memento; }
- }
-
- protected override LiteralExpression<T> thisInstance
- {
- get { return this; }
- }
-
- protected override void configureMemento(PluginFamily family)
- {
- _memento.Instance = _target;
- }
-
- protected override void validate()
- {
- }
-
- protected override void buildMemento()
- {
- _memento = new LiteralMemento(null);
- }
-
- public override void ValidatePluggability(Type pluginType)
- {
- ExpressionValidator.ValidatePluggabilityOf(_target.GetType()).IntoPluginType(pluginType);
- }
- }
-}
\ No newline at end of file
Deleted: trunk/Source/StructureMap/Configuration/DSL/Expressions/MementoBuilder.cs
===================================================================
--- trunk/Source/StructureMap/Configuration/DSL/Expressions/MementoBuilder.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap/Configuration/DSL/Expressions/MementoBuilder.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -1,122 +0,0 @@
-using System;
-using System.Collections.Generic;
-using StructureMap.Graph;
-using StructureMap.Interceptors;
-
-namespace StructureMap.Configuration.DSL.Expressions
-{
- public abstract class MementoBuilder<T> : IExpression, IMementoBuilder
- {
- protected readonly Type _pluginType;
- protected List<IExpression> _children = new List<IExpression>();
- private string _instanceKey = null;
-
- public MementoBuilder(Type pluginType)
- {
- _pluginType = pluginType;
- buildMemento();
- memento.InstanceKey = Guid.NewGuid().ToString();
- }
-
- protected abstract InstanceMemento memento { get; }
-
- protected abstract T thisInstance { get; }
-
- public string InstanceKey
- {
- get { return memento.InstanceKey; }
- set { memento.InstanceKey = value; }
- }
-
- internal Type PluginType
- {
- get { return _pluginType; }
- }
-
- #region IExpression Members
-
- void IExpression.Configure(PluginGraph graph)
- {
- validate();
- PluginFamily family = graph.LocateOrCreateFamilyForType((Type) _pluginType);
- configureMemento(family);
-
- if (!string.IsNullOrEmpty(_instanceKey))
- {
- memento.InstanceKey = _instanceKey;
- }
-
- family.Source.AddExternalMemento(memento);
-
- foreach (IExpression child in _children)
- {
- child.Configure(graph);
- }
- }
-
- #endregion
-
- #region IMementoBuilder Members
-
- InstanceMemento IMementoBuilder.BuildMemento(PluginFamily family)
- {
- return buildMementoFromFamily(family);
- }
-
- InstanceMemento IMementoBuilder.BuildMemento(PluginGraph graph)
- {
- PluginFamily family = graph.LocateOrCreateFamilyForType(_pluginType);
- return buildMementoFromFamily(family);
- }
-
- public void SetInstanceName(string instanceKey)
- {
- _instanceKey = instanceKey;
- }
-
- public abstract void ValidatePluggability(Type pluginType);
-
- #endregion
-
- protected abstract void configureMemento(PluginFamily family);
-
- protected abstract void validate();
-
- public T WithName(string instanceKey)
- {
- memento.InstanceKey = instanceKey;
- 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;
- }
-
- protected abstract void buildMemento();
-
- private InstanceMemento buildMementoFromFamily(PluginFamily family)
- {
- validate();
- configureMemento(family);
- return memento;
- }
-
-
- protected void addChildExpression(IExpression expression)
- {
- _children.Add(expression);
- }
- }
-}
\ No newline at end of file
Deleted: trunk/Source/StructureMap/Configuration/DSL/Expressions/PropertyExpression.cs
===================================================================
--- trunk/Source/StructureMap/Configuration/DSL/Expressions/PropertyExpression.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap/Configuration/DSL/Expressions/PropertyExpression.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -1,46 +0,0 @@
-using System.Configuration;
-using StructureMap.Configuration.Mementos;
-
-namespace StructureMap.Configuration.DSL.Expressions
-{
- /// <summary>
- /// Defines the value of a primitive argument to a constructur argument
- /// </summary>
- public class PropertyExpression
- {
- private readonly InstanceExpression _instance;
- private readonly MemoryInstanceMemento _memento;
- private readonly string _propertyName;
-
- public PropertyExpression(InstanceExpression instance, MemoryInstanceMemento memento, string propertyName)
- {
- _instance = instance;
- _memento = memento;
- _propertyName = propertyName;
- }
-
- /// <summary>
- /// Sets the value of the constructor argument
- /// </summary>
- /// <param name="propertyValue"></param>
- /// <returns></returns>
- public InstanceExpression EqualTo(object propertyValue)
- {
- _memento.SetProperty(_propertyName, propertyValue.ToString());
- return _instance;
- }
-
- /// <summary>
- /// Sets the value of the constructor argument to the key/value in the
- /// AppSettings
- /// </summary>
- /// <param name="appSettingKey"></param>
- /// <returns></returns>
- public InstanceExpression EqualToAppSetting(string appSettingKey)
- {
- string propertyValue = ConfigurationManager.AppSettings[appSettingKey];
- _memento.SetProperty(_propertyName, propertyValue);
- return _instance;
- }
- }
-}
\ No newline at end of file
Deleted: trunk/Source/StructureMap/Configuration/DSL/Expressions/PrototypeExpression.cs
===================================================================
--- trunk/Source/StructureMap/Configuration/DSL/Expressions/PrototypeExpression.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap/Configuration/DSL/Expressions/PrototypeExpression.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -1,51 +0,0 @@
-using System;
-using StructureMap.Configuration.Mementos;
-using StructureMap.Graph;
-
-namespace StructureMap.Configuration.DSL.Expressions
-{
- /// <summary>
- /// Sets up a Prototype instance of type T
- /// </summary>
- /// <typeparam name="T"></typeparam>
- public class PrototypeExpression<T> : MementoBuilder<PrototypeExpression<T>>
- {
- private readonly T _prototype;
- private PrototypeMemento _memento;
-
- public PrototypeExpression(T prototype) : base(typeof (T))
- {
- _prototype = prototype;
- }
-
- protected override InstanceMemento memento
- {
- get { return _memento; }
- }
-
- protected override PrototypeExpression<T> thisInstance
- {
- get { return this; }
- }
-
- protected override void configureMemento(PluginFamily family)
- {
- _memento.Prototype = (ICloneable) _prototype;
- }
-
- protected override void validate()
- {
- // TODO
- }
-
- protected override void buildMemento()
- {
- _memento = new PrototypeMemento(string.Empty, (ICloneable) _prototype);
- }
-
- public override void ValidatePluggability(Type pluginType)
- {
- ExpressionValidator.ValidatePluggabilityOf(_prototype.GetType()).IntoPluginType(pluginType);
- }
- }
-}
\ No newline at end of file
Deleted: trunk/Source/StructureMap/Configuration/DSL/Expressions/UserControlExpression.cs
===================================================================
--- trunk/Source/StructureMap/Configuration/DSL/Expressions/UserControlExpression.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap/Configuration/DSL/Expressions/UserControlExpression.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -1,46 +0,0 @@
-using System;
-using StructureMap.Configuration.Mementos;
-using StructureMap.Graph;
-
-namespace StructureMap.Configuration.DSL.Expressions
-{
- 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
- }
- }
-}
\ No newline at end of file
Deleted: trunk/Source/StructureMap/Configuration/DSL/ReferenceMementoBuilder.cs
===================================================================
--- trunk/Source/StructureMap/Configuration/DSL/ReferenceMementoBuilder.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap/Configuration/DSL/ReferenceMementoBuilder.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -1,45 +0,0 @@
-using System;
-using StructureMap.Configuration.DSL.Expressions;
-using StructureMap.Configuration.Mementos;
-using StructureMap.Graph;
-
-namespace StructureMap.Configuration.DSL
-{
- public class ReferenceMementoBuilder : IMementoBuilder
- {
- private InstanceMemento _memento;
-
- public ReferenceMementoBuilder(string referenceKey)
- {
- _memento = MemoryInstanceMemento.CreateReferencedInstanceMemento(referenceKey);
- }
-
- #region IMementoBuilder Members
-
- 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;
- }
-
- #endregion
- }
-}
\ No newline at end of file
Deleted: trunk/Source/StructureMap/Configuration/Mementos/ExplicitArgumentMemento.cs
===================================================================
--- trunk/Source/StructureMap/Configuration/Mementos/ExplicitArgumentMemento.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap/Configuration/Mementos/ExplicitArgumentMemento.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -1,68 +0,0 @@
-using System;
-
-namespace StructureMap.Configuration.Mementos
-{
- public class ExplicitArgumentMemento : InstanceMemento
- {
- private readonly ExplicitArguments _args;
- private InstanceMemento _inner;
-
- public ExplicitArgumentMemento(ExplicitArguments args, InstanceMemento inner)
- {
- _args = args;
- _inner = inner;
- }
-
-
- protected override string innerConcreteKey
- {
- get { return _inner.ConcreteKey; }
- }
-
- protected override string innerInstanceKey
- {
- get { return _inner.InstanceKey; }
- }
-
- public override bool IsReference
- {
- get { return false; }
- }
-
- public override string ReferenceKey
- {
- get { return _inner.ReferenceKey; }
- }
-
- protected override object buildInstance(IInstanceCreator creator)
- {
- if (_inner == null)
- {
- _inner = creator.DefaultMemento;
- }
-
- return base.buildInstance(creator);
- }
-
- protected override string getPropertyValue(string Key)
- {
- return _args.GetArg(Key) ?? _inner.GetProperty(Key);
- }
-
- protected override InstanceMemento getChild(string Key)
- {
- return _inner.GetChildMemento(Key);
- }
-
- public override object GetChild(string key, string typeName, Pipeline.IInstanceCreator instanceCreator)
- {
- Type type = Type.GetType(typeName, true);
- return _args.Get(type) ?? base.GetChild(key, typeName, instanceCreator);
- }
-
- public override InstanceMemento[] GetChildrenArray(string Key)
- {
- return _inner.GetChildrenArray(Key);
- }
- }
-}
\ No newline at end of file
Deleted: trunk/Source/StructureMap/ConstructorMemento.cs
===================================================================
--- trunk/Source/StructureMap/ConstructorMemento.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap/ConstructorMemento.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -1,40 +0,0 @@
-using System;
-using StructureMap.Configuration.Mementos;
-
-namespace StructureMap
-{
- public delegate PLUGINTYPE BuildObjectDelegate<PLUGINTYPE>();
-
- public class ConstructorMemento<PLUGINTYPE> : MemoryInstanceMemento
- {
- private BuildObjectDelegate<PLUGINTYPE> _builder;
-
-
- public ConstructorMemento()
- {
- }
-
- public ConstructorMemento(string instanceKey, BuildObjectDelegate<PLUGINTYPE> builder)
- : base(instanceKey, instanceKey)
- {
- _builder = builder;
- }
-
- public ConstructorMemento(BuildObjectDelegate<PLUGINTYPE> builder)
- : this(Guid.NewGuid().ToString(), builder)
- {
- }
-
-
- public BuildObjectDelegate<PLUGINTYPE> Builder
- {
- get { return _builder; }
- set { _builder = value; }
- }
-
- protected override object buildInstance(IInstanceCreator creator)
- {
- return _builder();
- }
- }
-}
\ No newline at end of file
Deleted: trunk/Source/StructureMap/Graph/DefinitionSource.cs
===================================================================
--- trunk/Source/StructureMap/Graph/DefinitionSource.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap/Graph/DefinitionSource.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -1,12 +0,0 @@
-namespace StructureMap.Graph
-{
- /// <summary>
- /// Specifies whether a PluginGraphObject is defined Explicitly in the configuration file,
- /// or implicitly through the [PluginFamily] or [Pluggable] attributes
- /// </summary>
- public enum DefinitionSource
- {
- Implicit,
- Explicit
- }
-}
\ No newline at end of file
Deleted: trunk/Source/StructureMap/Graph/Deployable.cs
===================================================================
--- trunk/Source/StructureMap/Graph/Deployable.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap/Graph/Deployable.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -1,73 +0,0 @@
-using System.Collections.Generic;
-
-namespace StructureMap.Graph
-{
- /// <summary>
- /// Base class for PluginGraphObject classes that can be marked for deployment
- /// targets.
- /// </summary>
- public abstract class Deployable
- {
- public const string ALL = "All";
-
- private List<string> _deploymentTargets;
-
- public Deployable()
- {
- _deploymentTargets = new List<string>();
- }
-
- public Deployable(string[] deploymentTargets) : this()
- {
- DeploymentTargets = deploymentTargets;
- }
-
- /// <summary>
- /// A string array of the valid deployment options for the PluginGraphObject.
- /// </summary>
- public string[] DeploymentTargets
- {
- get { return _deploymentTargets.ToArray(); }
- set
- {
- _deploymentTargets.Clear();
- _deploymentTargets.AddRange(value);
- }
- }
-
- /// <summary>
- /// Simple string description of the deployment options for the PluginGraphObject
- /// </summary>
- public string DeploymentDescription
- {
- get
- {
- string[] targets = DeploymentTargets;
- if (targets.Length == 0)
- {
- return "All";
- }
- else
- {
- return string.Join(", ", targets);
- }
- }
- }
-
- /// <summary>
- /// Returns a boolean flag denoting whether or not the PluginGraphObject is deployed
- /// for the deploymentTarget
- /// </summary>
- /// <param name="deploymentTarget"></param>
- /// <returns></returns>
- public bool IsDeployed(string deploymentTarget)
- {
- if (_deploymentTargets.Count == 0 || _deploymentTargets.Contains(ALL))
- {
- return true;
- }
-
- return _deploymentTargets.Contains(deploymentTarget);
- }
- }
-}
\ No newline at end of file
Modified: trunk/Source/StructureMap/Graph/PluginFamily.cs
===================================================================
--- trunk/Source/StructureMap/Graph/PluginFamily.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap/Graph/PluginFamily.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -139,9 +139,12 @@
}
// TODO -- Got a big problem here. Intances need to be copied over
- foreach (Instance instance in GetAllInstances())
+ foreach (IDiagnosticInstance instance in GetAllInstances())
{
- throw new NotImplementedException();
+ if (instance.CanBePartOfPluginFamily(templatedFamily))
+ {
+ templatedFamily.AddInstance((Instance)instance);
+ }
}
// Need to attach the new PluginFamily to the old PluginGraph
Deleted: trunk/Source/StructureMap/Graph/PluginGraphObjectCollection.cs
===================================================================
--- trunk/Source/StructureMap/Graph/PluginGraphObjectCollection.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap/Graph/PluginGraphObjectCollection.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -1,72 +0,0 @@
-using System;
-using System.Collections;
-
-namespace StructureMap.Graph
-{
- public abstract class PluginGraphObjectCollection : MarshalByRefObject, ICollection
- {
- private readonly PluginGraph _pluginGraph;
-
- public PluginGraphObjectCollection(PluginGraph pluginGraph) : base()
- {
- _pluginGraph = pluginGraph;
- }
-
- protected abstract ICollection innerCollection { get; }
-
- #region ICollection Members
-
- public IEnumerator GetEnumerator()
- {
- ArrayList list = new ArrayList(innerCollection);
- try
- {
- list.Sort();
- }
- catch (Exception)
- {
- // no-op. Only happens in trouble-shooting instances anyway
- }
-
- return list.GetEnumerator();
- }
-
- public void CopyTo(Array array, int index)
- {
- innerCollection.CopyTo(array, index);
- }
-
- public int Count
- {
- get { return innerCollection.Count; }
- }
-
- public object SyncRoot
- {
- get { return innerCollection.SyncRoot; }
- }
-
- public bool IsSynchronized
- {
- get { return innerCollection.IsSynchronized; }
- }
-
- #endregion
-
- protected void verifySealed()
- {
- if (!_pluginGraph.IsSealed)
- {
- throw new InvalidOperationException("This PluginGraph is not Sealed!");
- }
- }
-
- protected void verifyNotSealed()
- {
- if (_pluginGraph.IsSealed)
- {
- throw new InvalidOperationException("This PluginGraph is Sealed!");
- }
- }
- }
-}
\ No newline at end of file
Deleted: trunk/Source/StructureMap/IInstanceCreator.cs
===================================================================
--- trunk/Source/StructureMap/IInstanceCreator.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap/IInstanceCreator.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -1,8 +0,0 @@
-namespace StructureMap
-{
- public interface IInstanceCreator
- {
- InstanceMemento DefaultMemento { get; }
- object BuildInstance(InstanceMemento memento);
- }
-}
\ No newline at end of file
Modified: trunk/Source/StructureMap/Pipeline/ConfiguredInstance.cs
===================================================================
--- trunk/Source/StructureMap/Pipeline/ConfiguredInstance.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap/Pipeline/ConfiguredInstance.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -92,14 +92,26 @@
InstanceBuilder IConfiguredInstance.FindBuilder(InstanceBuilderList builders)
{
+ if (!string.IsNullOrEmpty(ConcreteKey))
+ {
+ InstanceBuilder builder = builders.FindByConcreteKey(ConcreteKey);
+ if (builder != null) return builder;
+ }
+
if (_pluggedType != null)
{
return builders.FindByType(_pluggedType);
}
- return builders.FindByConcreteKey(_concreteKey);
+ return null;
}
+
+ protected override bool canBePartOfPluginFamily(PluginFamily family)
+ {
+ return family.Plugins.HasPlugin(ConcreteKey);
+ }
+
public ConfiguredInstance SetProperty(string propertyName, string propertyValue)
{
_properties[propertyName] = propertyValue;
@@ -421,6 +433,8 @@
return _instance;
}
+
+
}
}
}
\ No newline at end of file
Modified: trunk/Source/StructureMap/Pipeline/Instance.cs
===================================================================
--- trunk/Source/StructureMap/Pipeline/Instance.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap/Pipeline/Instance.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -17,8 +17,12 @@
object ApplyInterception(Type pluginType, object actualValue);
}
+ public interface IDiagnosticInstance
+ {
+ bool CanBePartOfPluginFamily(PluginFamily family);
+ }
- public abstract class Instance
+ public abstract class Instance : IDiagnosticInstance
{
private string _name = Guid.NewGuid().ToString();
private InstanceInterceptor _interceptor = new NulloInterceptor();
@@ -56,9 +60,15 @@
protected abstract object build(Type pluginType, IInstanceCreator creator);
+ bool IDiagnosticInstance.CanBePartOfPluginFamily(PluginFamily family)
+ {
+ return canBePartOfPluginFamily(family);
+ }
- //public abstract void Diagnose<T>(IInstanceCreator creator, IInstanceDiagnostics diagnostics) where T : class;
- //public abstract void Describe<T>(IInstanceDiagnostics diagnostics) where T : class;
+ protected virtual bool canBePartOfPluginFamily(PluginFamily family)
+ {
+ return true;
+ }
}
public abstract class ExpressedInstance<T> : Instance
Modified: trunk/Source/StructureMap/Properties/AssemblyInfo.cs
===================================================================
--- trunk/Source/StructureMap/Properties/AssemblyInfo.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap/Properties/AssemblyInfo.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -12,4 +12,4 @@
[assembly :
InternalsVisibleTo(
"StructureMap.AutoMocking, PublicKey=00240000048000009400000006020000002400005253413100040000010001008d9a2a76e43cd9b1b1944b1f3b489a046b33f0bcd755b25cc5d3ed7b18ded38240d6db7578cd986c72d3feb4f94a7ab26fcfa41e3e4f41cf2c029fba91159db05c44d63f0b2bfac24353a07f4a1230dd3d4240340adafa2275277fa083c75958062cd0e60016701db6af7ae718efdf1e802a840595b49c290964255b3c60c494"
- )]
\ No newline at end of file
+ )]
Modified: trunk/Source/StructureMap.Testing/AlternativeConfigurationTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/AlternativeConfigurationTester.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap.Testing/AlternativeConfigurationTester.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -41,7 +41,7 @@
Assert.AreEqual(color, widget.Color);
}
- [Test, Ignore("Until Generics support is fixed")]
+ [Test]
public void AddNodeDirectly()
{
string xml = "<StructureMap><Assembly Name=\"StructureMap.Testing.GenericWidgets\"/></StructureMap>";
Deleted: trunk/Source/StructureMap.Testing/Configuration/DSL/ChildInstanceExpressionTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Configuration/DSL/ChildInstanceExpressionTester.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap.Testing/Configuration/DSL/ChildInstanceExpressionTester.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -1,78 +0,0 @@
-using NUnit.Framework;
-using StructureMap.Configuration.DSL;
-using StructureMap.Configuration.DSL.Expressions;
-using StructureMap.Configuration.Mementos;
-using StructureMap.Testing.Widget4;
-
-namespace StructureMap.Testing.Configuration.DSL
-{
- [TestFixture]
- public class ChildInstanceExpressionTester
- {
- #region Setup/Teardown
-
- [SetUp]
- public void SetUp()
- {
- }
-
- #endregion
-
- [Test,
- ExpectedException(typeof (StructureMapException),
- "StructureMap Exception Code: 303\nType System.String,mscorlib is either abstract or cannot be plugged into Type StructureMap.Testing.Configuration.DSL.IType,StructureMap.Testing"
- )]
- public void CantCastTheRequestedConcreteType()
- {
- InstanceExpression instance = new InstanceExpression(typeof (IStrategy));
- MemoryInstanceMemento memento = new MemoryInstanceMemento();
-
- ChildInstanceExpression expression =
- new ChildInstanceExpression(instance, memento, "a property", typeof (IType));
- expression.IsConcreteType<string>();
- }
-
- [Test,
- ExpectedException(typeof (StructureMapException),
- "StructureMap Exception Code: 303\nType StructureMap.Testing.Configuration.DSL.AbstractType,StructureMap.Testing is either abstract or cannot be plugged into Type StructureMap.Testing.Configuration.DSL.IType,StructureMap.Testing"
- )]
- public void CantCastTheRequestedConcreteType2()
- {
- InstanceExpression instance = new InstanceExpression(typeof (IStrategy));
- MemoryInstanceMemento memento = new MemoryInstanceMemento();
-
- ChildInstanceExpression expression =
- new ChildInstanceExpression(instance, memento, "a property", typeof (IType));
- expression.IsConcreteType<AbstractType>();
- }
-
-
- [Test,
- ExpectedException(typeof (StructureMapException),
- "StructureMap Exception Code: 303\nType StructureMap.Testing.Configuration.DSL.AbstractType,StructureMap.Testing is either abstract or cannot be plugged into Type StructureMap.Testing.Configuration.DSL.IType,StructureMap.Testing"
- )]
- public void CantCastTheRequestedPluggedType3()
- {
- InstanceExpression instance = new InstanceExpression(typeof (IStrategy));
- MemoryInstanceMemento memento = new MemoryInstanceMemento();
-
- ChildInstanceExpression expression =
- new ChildInstanceExpression(instance, memento, "a property", typeof (IType));
- InstanceExpression child = Registry.Instance<IType>().UsingConcreteType<AbstractType>();
-
- expression.Is(child);
- }
- }
-
- public interface IType
- {
- }
-
- public abstract class AbstractType : IType
- {
- }
-
- public class ConcreteType : AbstractType
- {
- }
-}
\ No newline at end of file
Deleted: trunk/Source/StructureMap.Testing/Configuration/DSL/LiteralExpressionTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Configuration/DSL/LiteralExpressionTester.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap.Testing/Configuration/DSL/LiteralExpressionTester.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -1,67 +0,0 @@
-using NUnit.Framework;
-using StructureMap.Configuration.DSL;
-using StructureMap.Configuration.DSL.Expressions;
-using StructureMap.Configuration.Mementos;
-using StructureMap.Graph;
-using StructureMap.Testing.Widget;
-
-namespace StructureMap.Testing.Configuration.DSL
-{
- [TestFixture]
- public class LiteralExpressionTester
- {
- #region Setup/Teardown
-
- [SetUp]
- public void SetUp()
- {
- }
-
- #endregion
-
- [Test]
- public void BuildFromInstanceManager()
- {
- ColorWidget theWidget = new ColorWidget("Red");
- LiteralExpression<IWidget> expression = new LiteralExpression<IWidget>(theWidget);
- PluginGraph graph = new PluginGraph();
- ((IExpression) expression).Configure(graph);
-
- InstanceManager manager = new InstanceManager(graph);
-
- IWidget actualWidget = manager.CreateInstance<IWidget>(expression.InstanceKey);
- Assert.AreSame(theWidget, actualWidget);
- }
-
- [Test]
- public void ConfiguresALiteral()
- {
- ColorWidget theWidget = new ColorWidget("Red");
- LiteralExpression<IWidget> expression = new LiteralExpression<IWidget>(theWidget);
- PluginGraph graph = new PluginGraph();
- ((IExpression) expression).Configure(graph);
-
- PluginFamily family = graph.PluginFamilies[typeof (IWidget)];
- Assert.IsNotNull(family);
-
- LiteralMemento memento = (LiteralMemento) family.Source.GetMemento(expression.InstanceKey);
- Assert.AreSame(theWidget, memento.Build(null));
- }
-
- [Test]
- public void OverrideTheInstanceKey()
- {
- ColorWidget theWidget = new ColorWidget("Red");
- LiteralExpression<IWidget> expression = new LiteralExpression<IWidget>(theWidget);
- expression.WithName("Blue");
- PluginGraph graph = new PluginGraph();
- ((IExpression) expression).Configure(graph);
-
- PluginFamily family = graph.PluginFamilies[typeof (IWidget)];
- Assert.IsNotNull(family);
-
- LiteralMemento memento = (LiteralMemento) family.Source.GetMemento(expression.InstanceKey);
- Assert.AreSame(theWidget, memento.Build(null));
- }
- }
-}
\ No newline at end of file
Deleted: trunk/Source/StructureMap.Testing/Configuration/DSL/ReferenceMementoBuilderTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Configuration/DSL/ReferenceMementoBuilderTester.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap.Testing/Configuration/DSL/ReferenceMementoBuilderTester.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -1,51 +0,0 @@
-using NUnit.Framework;
-using StructureMap.Configuration.DSL;
-using StructureMap.Configuration.DSL.Expressions;
-using StructureMap.Graph;
-
-namespace StructureMap.Testing.Configuration.DSL
-{
- [TestFixture]
- public class ReferenceMementoBuilderTester
- {
- #region Setup/Teardown
-
- [SetUp]
- public void SetUp()
- {
- }
-
- #endregion
-
- public interface Abstraction
- {
- }
-
- public class Concretion1 : Abstraction
- {
- }
-
- public class Concretion2 : Abstraction
- {
- }
-
- [Test]
- public void CreateMemento()
- {
- Registry registry = new Registry();
- registry.AddInstanceOf<Abstraction>().UsingConcreteType<Concretion1>().WithName("One");
- registry.AddInstanceOf<Abstraction>().UsingConcreteType<Concretion2>().WithName("Two");
-
- IInstanceManager manager = registry.BuildInstanceManager();
- ReferenceMementoBuilder builder1 = new ReferenceMementoBuilder("One");
- ReferenceMementoBuilder builder2 = new ReferenceMementoBuilder("Two");
-
- InstanceMemento memento1 = ((IMementoBuilder) builder1).BuildMemento(new PluginGraph());
- InstanceMemento memento2 = ((IMementoBuilder) builder2).BuildMemento(new PluginGraph());
-
-
- Assert.IsInstanceOfType(typeof (Concretion1), manager.CreateInstance<Abstraction>(memento1));
- Assert.IsInstanceOfType(typeof (Concretion2), manager.CreateInstance<Abstraction>(memento2));
- }
- }
-}
\ No newline at end of file
Deleted: trunk/Source/StructureMap.Testing/Configuration/DSL/UserControlExpressionTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Configuration/DSL/UserControlExpressionTester.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap.Testing/Configuration/DSL/UserControlExpressionTester.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -1,57 +0,0 @@
-using NUnit.Framework;
-using StructureMap.Configuration.DSL.Expressions;
-using StructureMap.Configuration.Mementos;
-using StructureMap.Graph;
-
-namespace StructureMap.Testing.Configuration.DSL
-{
- [TestFixture]
- public class UserControlExpressionTester
- {
- #region Setup/Teardown
-
- [SetUp]
- public void SetUp()
- {
- }
-
- #endregion
-
- [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
- {
- }
-}
\ No newline at end of file
Deleted: trunk/Source/StructureMap.Testing/ConstructorMementoTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/ConstructorMementoTester.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap.Testing/ConstructorMementoTester.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -1,26 +0,0 @@
-using NUnit.Framework;
-
-namespace StructureMap.Testing
-{
- [TestFixture]
- public class ConstructorMementoTester
- {
- #region Setup/Teardown
-
- [SetUp]
- public void SetUp()
- {
- }
-
- #endregion
-
- [Test]
- public void Construct()
- {
- ConstructorMemento<string> memento = new ConstructorMemento<string>("A", delegate { return "Hello"; });
- Assert.AreEqual("A", memento.InstanceKey);
- string actual = (string) memento.Build(null);
- Assert.AreEqual("Hello", actual);
- }
- }
-}
\ No newline at end of file
Modified: trunk/Source/StructureMap.Testing/Container/InstanceManagerTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Container/InstanceManagerTester.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap.Testing/Container/InstanceManagerTester.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -137,7 +137,7 @@
}
- [Test, Ignore("Temporarily suspending generics support")]
+ [Test]
public void FindAPluginFamilyForAGenericTypeFromPluginTypeName()
{
Type serviceType = typeof (IService<string>);
Modified: trunk/Source/StructureMap.Testing/GenericsAcceptanceTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/GenericsAcceptanceTester.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap.Testing/GenericsAcceptanceTester.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -8,7 +8,7 @@
namespace StructureMap.Testing
{
- [TestFixture, Ignore("Temporarily suspending generics support")]
+ [TestFixture]
public class GenericsAcceptanceTester
{
#region Setup/Teardown
Modified: trunk/Source/StructureMap.Testing/GenericsIntegrationTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/GenericsIntegrationTester.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap.Testing/GenericsIntegrationTester.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -6,7 +6,7 @@
namespace StructureMap.Testing
{
- [TestFixture, Ignore("Temporarily suspending generics support")]
+ [TestFixture]
public class GenericsIntegrationTester
{
#region Setup/Teardown
Modified: trunk/Source/StructureMap.Testing/Graph/GenericsPluginGraphTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Graph/GenericsPluginGraphTester.cs 2008-04-11 23:32:28 UTC (rev 79)
+++ trunk/Source/StructureMap.Testing/Graph/GenericsPluginGraphTester.cs 2008-04-12 13:45:08 UTC (rev 80)
@@ -4,7 +4,7 @@
namespace StructureMap.Testing.Graph
{
- [TestFixture, Ignore("Temporarily suspending generics support")]
+ [TestFixture]
public class GenericsPluginGraphTester
{
#region Setup/Teardown
@@ -36,21 +36,14 @@
family.Plugins.Add(typeof (SecondGenericService<>), "Second");
family.Plugins.Add(typeof (ThirdGenericService<>), "Third");
- PluginFamily intFamily = family.CreateTemplatedClone(typeof (int));
- PluginFamily stringFamily = family.CreateTemplatedClone(typeof (string));
+ InstanceManager manager = new InstanceManager(pluginGraph);
- InstanceFactory intFactory = new InstanceFactory(intFamil...
[truncated message content] |