Hi,
i have problems specifying string parameters with xml configuration,
following is a test that shows 2 different behaviours: one with the
problem and one without.
----- START GenericBugTest.cs
----------------------------------------------------------------------------------------------------
namespace SpikeWindsor
{
[TestFixture]
public class GenericBugTest
{
[Test]
public void Bug()
{
var exception =
Assert.Throws<DependencyResolverException>(() =>
new WindsorContainer(new XmlInterpreter("GenericsWithStrings.xml")));
Assert.That(exception.Message, Is.EqualTo("Key invalid
for
parameter key. Thus the kernel was unable to override the service
dependency"));
}
[Test]
public void Correct()
{
var container = new WindsorContainer(new XmlInterpreter
("GenericsWithComponents.xml"));
Assert.That(container.Resolve<TypeWith2Generics<string,
string>>
("typewith2generics"), Is.Not.Null);
}
}
public class TypeWith2Generics<TKey, TValue>
{
private readonly TKey _key;
private readonly TValue _value;
public TypeWith2Generics(TKey key, TValue value)
{
_key = key;
_value = value;
}
}
public class Component {}
}
----- END GenericBugTest.cs
----------------------------------------------------------------------------------------------------
----- START GenericsWithComponents.xml
----------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<components>
<component id="typewith2generics"
type="SpikeWindsor.TypeWith2Generics`2, SpikeWindsor">
<parameters>
<key>${component}</key>
<value>${component}</value>
</parameters>
</component>
<component id="component" type="SpikeWindsor.Component,
SpikeWindsor" />
</components>
</configuration>
----- END GenericsWithComponents.xml
----------------------------------------------------------------------------------------------------
----- START GenericsWithStrings.xml
----------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<components>
<component id="typewith2generics"
type="SpikeWindsor.TypeWith2Generics`2, SpikeWindsor">
<parameters>
<key>string value</key>
<value>string value 2</value>
</parameters>
</component>
</components>
</configuration>
----- END GenericsWithStrings.xml
----------------------------------------------------------------------------------------------------
Is this behaviour correct or it's a bug?
Thanks!
PS: this test project is available at
https://randomhacking.googlecode.com/svn/trunk/dotnet/SpikeWindsor
for the references checkout from
https://randomhacking.googlecode.com/svn/trunk/dotnet/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Development List" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---