A utility type that writes new log messages to the test harness log queue.
 /// <summary>
 /// Look through the classes for the [Exclusive] attribute. If found, 
 /// remove any classes where the attribute is not present.
 /// </summary>
 /// <param name="classes">The input list of classes.</param>
 /// <param name="logWriter">The log writer object.</param>
 public static void FilterExclusiveClasses(IList<ITestClass> classes, LogMessageWriter logWriter)
 {
     if (!TestAssemblyHelper.HasExclusiveClasses(classes))
     {
         return;
     }
     if (logWriter != null && ! _hasWarned)
     {
         logWriter.Warning(Properties.UnitTestMessage.TestClassHelper_ExclusiveClassesInUse);
         _hasWarned = true;
     }
     List<ITestClass> filtered = new List<ITestClass>();
     foreach (ITestClass cl in classes)
     {
         if (ReflectionUtility.HasAttribute(cl.Type, typeof(ExclusiveAttribute)))
         {
             filtered.Add(cl);
         }
     }
     classes.Replace(filtered);
 }
 /// <summary>
 /// Look through the methods for the [Exclusive] attribute. If found, 
 /// remove any methods where the attribute is not present.
 /// </summary>
 /// <param name="methods">The methods to filter.</param>
 /// <param name="logWriter">The log writer object.</param>
 public static void FilterExclusiveMethods(IList<ITestMethod> methods, LogMessageWriter logWriter)
 {
     if (HasExclusiveMethods(methods) == false)
     {
         return;
     }
     if (logWriter != null && ! _hasWarned)
     {
         logWriter.Warning(Properties.UnitTestMessage.TestMethodHelper_ExclusiveMethodsInUse);
         _hasWarned = true;
     }
     List<ITestMethod> filtered = new List<ITestMethod>();
     foreach (var m in methods)
     {
         if (ReflectionUtility.HasAttribute(m, typeof(ExclusiveAttribute)))
         {
             filtered.Add(m);
         }
     }
     methods.Replace(filtered);
 }
Example #3
0
        /// <summary>
        /// Look through the methods for the [Exclusive] attribute. If found,
        /// remove any methods where the attribute is not present.
        /// </summary>
        /// <param name="methods">The methods to filter.</param>
        /// <param name="logWriter">The log writer object.</param>
        public static void FilterExclusiveMethods(IList <ITestMethod> methods, LogMessageWriter logWriter)
        {
            if (HasExclusiveMethods(methods) == false)
            {
                return;
            }
            if (logWriter != null && !_hasWarned)
            {
                logWriter.Warning(Properties.UnitTestMessage.TestMethodHelper_ExclusiveMethodsInUse);
                _hasWarned = true;
            }
            List <ITestMethod> filtered = new List <ITestMethod>();

            foreach (var m in methods)
            {
                if (ReflectionUtility.HasAttribute(m, typeof(ExclusiveAttribute)))
                {
                    filtered.Add(m);
                }
            }
            methods.Replace(filtered);
        }
        /// <summary>
        /// Look through the classes for the [Exclusive] attribute. If found,
        /// remove any classes where the attribute is not present.
        /// </summary>
        /// <param name="classes">The input list of classes.</param>
        /// <param name="logWriter">The log writer object.</param>
        public static void FilterExclusiveClasses(IList <ITestClass> classes, LogMessageWriter logWriter)
        {
            if (!TestAssemblyHelper.HasExclusiveClasses(classes))
            {
                return;
            }
            if (logWriter != null && !_hasWarned)
            {
                logWriter.Warning(Properties.UnitTestMessage.TestClassHelper_ExclusiveClassesInUse);
                _hasWarned = true;
            }
            List <ITestClass> filtered = new List <ITestClass>();

            foreach (ITestClass cl in classes)
            {
                if (ReflectionUtility.HasAttribute(cl.Type, typeof(ExclusiveAttribute)))
                {
                    filtered.Add(cl);
                }
            }
            classes.Replace(filtered);
        }