public void should_get_the_greediest_constructor_if_there_is_more_than_one()
        {
            var selector = new ConstructorSelector();
            var constructor = selector.Select(typeof (GreaterThanRule));

            constructor.GetParameters().Select(x => x.ParameterType)
                .ShouldHaveTheSameElementsAs(typeof (string), typeof (int));
        }
        public void should_get_the_greediest_constructor_if_there_is_more_than_one()
        {
            var selector = new ConstructorSelector(PluginGraph.CreateRoot());
            var constructor = selector.Select(typeof (GreaterThanRule), new DependencyCollection());

            constructor.GetParameters().Select(x => x.ParameterType)
                .ShouldHaveTheSameElementsAs(typeof (IWidget), typeof (Rule));
        }
        public void get_the_first_constructor_marked_with_the_attribute_if_it_exists()
        {
            var selector = new ConstructorSelector();

            var constructor = selector.Select(typeof (ComplexRule));

            constructor.GetParameters().Length
                .ShouldBe(7);
        }
        public void custom_selectors_have_precedence()
        {
            var selector = new ConstructorSelector();
            selector.Add(new PickTheFirstOne());

            selector.Select(typeof (ClassWithMultipleConstructors))
                .GetParameters().Select(x => x.ParameterType)
                .ShouldHaveTheSameElementsAs(typeof (IGateway));
        }
        public void get_the_first_constructor_marked_with_the_attribute_if_it_exists()
        {
            var selector = new ConstructorSelector(PluginGraph.CreateRoot());

            var constructor = selector.Select(typeof (ComplexRule), new DependencyCollection());

            constructor.GetParameters().Length
                .ShouldBe(7);
        }
Exemplo n.º 6
0
 public Policies(PluginGraph pluginGraph)
 {
     ConstructorSelector = new ConstructorSelector(pluginGraph);
 }