コード例 #1
0
        public void WithFooAndNoneRuntimeArguments_DefaultConstructorWasUsed()
        {
            var selector = new LightCore.Activation.Components.ConstructorSelector();

            var finalConstructor = this.Select(
                typeof(Foo).GetConstructors());

            Assert.That(finalConstructor, Is.Not.Null);
            Assert.That(finalConstructor == typeof(Foo).GetConstructor(Type.EmptyTypes));
        }
コード例 #2
0
        private ConstructorInfo Select(IEnumerable<ConstructorInfo> constructors, ArgumentContainer arguments, params Type[] registeredTypes)
        {
            var selector = new LightCore.Activation.Components.ConstructorSelector();

            var resolutionContext =
                new LightCore.Activation.ResolutionContext(
                    null,
                    RegistrationHelper.GetRegistrationContainerFor(registeredTypes),
                    arguments,
                    new ArgumentContainer());

            return selector
                .SelectConstructor(constructors, resolutionContext);
        }
コード例 #3
0
        private ConstructorInfo Select(IEnumerable <ConstructorInfo> constructors, ArgumentContainer arguments,
                                       params Type[] registeredTypes)
        {
            var selector = new LightCore.Activation.Components.ConstructorSelector();

            var resolutionContext =
                new ResolutionContext(
                    null,
                    RegistrationHelper.GetRegistrationContainerFor(registeredTypes),
                    arguments,
                    new ArgumentContainer());

            return(selector
                   .SelectConstructor(constructors, resolutionContext));
        }