[sm-users] Xml configuration overriding default values for properties when the property isn't defined in the xml

11 views
Skip to first unread message

Jason Imison

unread,
Apr 23, 2010, 5:50:26 AM4/23/10
to structuremap-users
I believe this is a regression in trunk. The following test should
pass :-


using NUnit.Framework;
using StructureMap.Graph;
using StructureMap.Testing.TestData;

namespace StructureMap.Testing.Bugs
{
public interface IVehicle
{
int Wheels { get; set; }
int Seats { get; set; }
}
public class Car : IVehicle
{
public Car()
{
Wheels = 4;
}

public int Wheels { get; set; }
public int Seats { get; set; }
}

[TestFixture]
public class MixedConfigurationAndDefaultPropertiesBug
{
[SetUp]
public void SetUp()
{
string xml =
@"
<StructureMap MementoStyle='Attribute'>
<DefaultInstance
PluginType='StructureMap.Testing.Bugs.IVehicle,StructureMap.Testing'

PluggedType='StructureMap.Testing.Bugs.Car,StructureMap.Testing'
Seats='2' />
</StructureMap>
";

_graph = DataMother.BuildPluginGraphFromXml(xml);
_container = new Container(_graph);
}


private Container _container;
private PluginGraph _graph;

[Test]
public void configuration_should_not_override_default_values()
{
var car = _container.GetInstance<IVehicle>();
car.Wheels.ShouldEqual(4);
}
}
}


This was working in earlier versions.

--
You received this message because you are subscribed to the Google Groups "structuremap-users" group.
To post to this group, send email to structure...@googlegroups.com.
To unsubscribe from this group, send email to structuremap-us...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/structuremap-users?hl=en.

Reply all
Reply to author
Forward
0 new messages