Ejemplo n.º 1
0
        /// <summary>
        /// Applies the settings of another test project as an overlay on top of this one.
        /// </summary>
        /// <remarks>
        /// <para>
        /// Overrides scalar settings (such as <see cref="ReportNameFormat"/>) with those of
        /// the overlay when they are specified (such as when <see cref="IsReportNameFormatSpecified" /> is true).
        /// Merges aggregate settings (such as lists of files).
        /// </para>
        /// </remarks>
        /// <param name="overlay">The test project to overlay on top of this one.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="overlay"/> is null.</exception>
        public void ApplyOverlay(TestProject overlay)
        {
            if (overlay == null)
            {
                throw new ArgumentNullException("overlay");
            }

            if (overlay.IsReportNameFormatSpecified)
            {
                ReportNameFormat = overlay.ReportNameFormat;
            }
            if (overlay.IsReportDirectorySpecified)
            {
                ReportDirectory = overlay.ReportDirectory;
            }
            if (overlay.IsTestRunnerFactoryNameSpecified)
            {
                TestRunnerFactoryName = overlay.TestRunnerFactoryName;
            }
            GenericCollectionUtils.ForEach(overlay.TestFilters, x => AddTestFilter(x.Copy()));
            GenericCollectionUtils.ForEach(overlay.TestRunnerExtensions, AddTestRunnerExtension);
            GenericCollectionUtils.ForEach(overlay.TestRunnerExtensionSpecifications, AddTestRunnerExtensionSpecification);
            TestPackage.ApplyOverlay(overlay.TestPackage);
        }