Exemplo n.º 1
0
        /// <summary>
        /// Gets a custom <see cref="IMessageFormatter"/> for a test method (specified by <paramref name="testMethodName"/>)
        /// or the <see cref="DefaultMessageFormatter"/> if no custom formatter was defined.
        /// </summary>
        /// <param name="testMethodName"> The name of the method under test. </param>
        /// <returns> The specified method's <see cref="IMessageFormatter"/>. </returns>
        internal static IMessageFormatter GetMessageFormatterFor(string testMethodName)
        {
            if (CustomMessageFormatters.TryGetValue(testMethodName, out IMessageFormatter formatter))
            {
                return(formatter);
            }

            return(DefaultMessageFormatter);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Set a custom <see cref="IMessageFormatter"/> for a test method (specified by <paramref name="testMethodName"/>).
 /// </summary>
 /// <param name="testMethodName"> The name of the method under test. </param>
 /// <param name="formatter"> The method's custom <see cref="IMessageFormatter"/>. </param>
 internal static void SetMessageFormatterFor(string testMethodName, IMessageFormatter formatter)
 {
     if (CustomMessageFormatters.ContainsKey(testMethodName))
     {
         CustomMessageFormatters[testMethodName] = formatter;
     }
     else
     {
         CustomMessageFormatters.Add(testMethodName, formatter);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Removes a custom <see cref="IMessageFormatter"/> for a test method (specified by <paramref name="testMethodName"/>)
 /// and use the <see cref="DefaultMessageFormatter"/> instead.
 /// </summary>
 /// <param name="testMethodName"> The name of the method under test. </param>
 internal static void ResetMessageFormatterFor(string testMethodName)
 {
     CustomMessageFormatters.Remove(testMethodName);
 }