/// <summary>
 /// Exclude a class (or methods) by filter that match the filenames.
 /// </summary>
 /// <param name="settings">The settings.</param>
 /// <param name="filter">The filter.</param>
 /// <returns>The same <see cref="OpenCoverSettings"/> instance so that multiple calls can be chained.</returns>
 public static OpenCoverSettings ExcludeByFile(this OpenCoverSettings settings, string filter)
 {
     if (settings == null)
     {
         throw new ArgumentNullException("settings");
     }
     settings.ExcludedFileFilters.Add(filter);
     return(settings);
 }
Exemple #2
0
 /// <summary>
 /// Sets the register-option to user-registry-access.
 /// </summary>
 /// <param name="settings">The settings.</param>
 /// <returns>The same <see cref="OpenCoverSettings"/> instance so that multiple calls can be chained.</returns>
 public static OpenCoverSettings WithRegisterUser(this OpenCoverSettings settings)
 {
     if (settings == null)
     {
         throw new ArgumentNullException(nameof(settings));
     }
     settings.Register = new OpenCoverRegisterOptionUser();
     return(settings);
 }
Exemple #3
0
 /// <summary>
 /// Exclude a class or method by filter
 /// that match attributes that have been applied.
 /// </summary>
 /// <param name="settings">The settings.</param>
 /// <param name="filter">The filter.</param>
 /// <returns>The same <see cref="OpenCoverSettings"/> instance so that multiple calls can be chained.</returns>
 public static OpenCoverSettings ExcludeByAttribute(this OpenCoverSettings settings, string filter)
 {
     if (settings == null)
     {
         throw new ArgumentNullException(nameof(settings));
     }
     settings.ExcludedAttributeFilters.Add(filter);
     return(settings);
 }
Exemple #4
0
 /// <summary>
 /// Adds the filter.
 /// </summary>
 /// <param name="settings">The settings.</param>
 /// <param name="filter">The filter.</param>
 /// <returns>The same <see cref="OpenCoverSettings"/> instance so that multiple calls can be chained.</returns>
 public static OpenCoverSettings WithFilter(this OpenCoverSettings settings, string filter)
 {
     if (settings == null)
     {
         throw new ArgumentNullException(nameof(settings));
     }
     settings.Filters.Add(filter);
     return(settings);
 }
Exemple #5
0
 /// <summary>
 /// Sets the register-option to dll-registration (i.e no registry-access).
 /// </summary>
 /// <param name="settings">The settings.</param>
 /// <param name="path">The path.</param>
 /// <returns>The same <see cref="OpenCoverSettings"/> instance so that multiple calls can be chained.</returns>
 public static OpenCoverSettings WithRegisterDll(this OpenCoverSettings settings, FilePath path)
 {
     if (settings == null)
     {
         throw new ArgumentNullException(nameof(settings));
     }
     settings.Register = new OpenCoverRegisterOptionDll(path);
     return(settings);
 }
Exemple #6
0
        public static void OpenCover(
            this ICakeContext context,
            Action <ICakeContext> action,
            FilePath outputFile,
            OpenCoverSettings settings)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            // Create the OpenCover runner.
            var runner = new OpenCoverRunner(
                context.FileSystem, context.Environment,
                context.ProcessRunner, context.Tools);

            // Run OpenCover.
            runner.Run(context, action, outputFile, settings);
        }