Esempio n. 1
0
        /// <summary>
        /// Returns a creation result for a dummy by combining two results.
        /// Successful results are preferred to failed. Failed results will have their reasons for failure aggregated.
        /// </summary>
        /// <param name="one">One result to merge. May be <code>null</code>.</param>
        /// <param name="other">The other result to merge. Must not be <code>null</code>.</param>
        /// <returns>A combined creation result. Successful if either input was successful, and failed otherwise.</returns>
        public static CreationResult MergeIntoDummyResult(CreationResult one, CreationResult other)
        {
            Guard.AgainstNull(other, "other");

            if (one == null || other.WasSuccessful)
            {
                return(other.AsDummyResult());
            }

            if (one.WasSuccessful)
            {
                return(one.AsDummyResult());
            }

            return(new CreationResult(
                       one.type,
                       CreationMode.Dummy,
                       MergeReasonsForFailure(one.reasonsForFailure, other.reasonsForFailure),
                       MergeConsideredConstructors(one.consideredConstructors, other.consideredConstructors)));
        }