Esempio n. 1
0
        /// <inheritdoc/>
        protected override bool TryGetConstructorArgument(ConstructorInfo constructor, int index, ParameterInfo parameter, out object argumentValue)
        {
            if (parameter.ParameterType == typeof(ITestOutputHelper))
            {
                argumentValue = new TestOutputHelper();
                return(true);
            }

            return(ClassFixtureMappings.TryGetValue(parameter.ParameterType, out argumentValue) ||
                   collectionFixtureMappings.TryGetValue(parameter.ParameterType, out argumentValue));
        }
        /// <inheritdoc/>
        protected override bool TryGetConstructorArgument(ConstructorInfo constructor, int index, ParameterInfo parameter, out object argumentValue)
        {
            Check.NotNull(nameof(parameter), parameter);
            object svc = this.serviceProvider?.GetService(parameter.ParameterType);

            if (svc != null)
            {
                argumentValue = svc;
                return(true);
            }

            if (parameter.ParameterType == typeof(ITestOutputHelper))
            {
                argumentValue = new TestOutputHelper();
                return(true);
            }

            return(ClassFixtureMappings.TryGetValue(parameter.ParameterType, out argumentValue) ||
                   collectionFixtureMappings.TryGetValue(parameter.ParameterType, out argumentValue));
        }