Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConstructorArgumentsMismatchException"/> class.
 /// </summary>
 /// <param name="message">
 /// The message.
 /// </param>
 /// <param name="typedFactoryType">
 /// The type of the factory interface.
 /// </param>
 /// <param name="nonMatchingParameters">
 /// The list of non-matching parameters.
 /// </param>
 /// <param name="innerException">
 /// The inner exception, documenting the resolution failure.
 /// </param>
 public ConstructorArgumentsMismatchException(string message,
                                              Type typedFactoryType,
                                              ParameterInfo[] nonMatchingParameters,
                                              ResolutionFailedException innerException)
     : base(message, innerException)
 {
     this.TypedFactoryType      = typedFactoryType;
     this.NonMatchingParameters = nonMatchingParameters;
 }
        public void ResolveAll_UnregisteredType_ThrowsDependencyResolutionFailedException()
        {
            var type      = typeof(string);
            var exception = new ResolutionFailedException(type, type.FullName, "Resolution failed", new Exception());

            _unityContainer.Resolve(type.MakeArrayType()).Throws(exception);

            Assert.Throws <DependencyResolutionFailedException>(() => _provider.ResolveAll(type));
        }
 public UnknownNotificationProtocolTypeException(NotificationProtocolType notificationProtocolType,
                                                 // ReSharper disable once SuggestBaseTypeForParameter
                                                 ResolutionFailedException exc) :
     base(Properties.Resources.UnknownNotificationProtocolType.FormatWith(notificationProtocolType), exc)
 {
 }
        private static ActivationException ErrorResolutionFailed(ResolutionFailedException inner)
        {
            string message = string.Format("Instance resolution failed. Type={0}, Name='{1}'.", inner.TypeRequested, inner.NameRequested);

            return(new ActivationException(message, inner));
        }