public void find_concrete_type_for_a_type_that_is_marked_with_default_constructor() { var pluginGraph = new PluginGraph(); var objectGraph = new ObjectGraph(typeof (ClassMarkedWithDefaultConstructor)); pluginGraph.InitializeConcreteType(objectGraph); // Should choose the no arg constructor objectGraph.ConcreteType.Constructor.GetParameters().Any().ShouldBeFalse(); }
public void use_the_constructor_selector_to_build_a_concrete_type() { var theCtor = GetType().GetConstructors().First(); var selector = MockRepository.GenerateMock<IConstructorSelector>(); var pluginGraph = new PluginGraph{ ConstructorSelector = selector }; var objectGraph = new ObjectGraph(GetType()); selector.Stub(x => x.Select(objectGraph, pluginGraph)).Return(theCtor); pluginGraph.InitializeConcreteType(objectGraph); objectGraph.ConcreteType.Constructor.ShouldBeTheSameAs(theCtor); }