Beispiel #1
0
        /// <summary>
        /// Scan the input files for unit tests and, if specified, generate a test package source file.
        /// </summary>
        /// <returns>True if successful or False if there were no unit tests in the input files or a test package couldn't be created.</returns>
        public override bool Execute()
        {
            List<string> generatorExtensions = new List<string>();

            Generator generator = new Generator();
            generator.Extensions = GenerateTestConsumer.ToStringCollection(this.extensions);
            generator.InputFiles = GenerateTestConsumer.ToListOfString(this.inputFiles);
            generator.OutputFile = null != this.outputFile ? this.outputFile.ItemSpec : null;
            generator.Message += new MessageEventHandler(this.MessageHandler);

            bool success = generator.Generate();
            this.inputFragments = GenerateTestConsumer.ToITaskItemArray(generator.InputFragments);
            return success;
        }
Beispiel #2
0
        /// <summary>
        /// Scan the input files for unit tests and, if specified, generate a test package source file.
        /// </summary>
        /// <param name="extensions">The WiX extensions used by the input files.</param>
        /// <param name="inputFiles">The WiX object and library files to scan for unit tests.</param>
        /// <param name="outputFile">The optional generated test package source file.</param>
        /// <param name="message">Message handler.</param>
        /// <param name="inputFragments">The subset of InputFiles that are fragments (i.e., are not entry sections like Product) and should be included in a test package.</param>
        /// <returns>True if successful or False if there were no unit tests in the input files or a test package couldn't be created.</returns>
        public static bool Generate(StringCollection extensions, List<string> inputFiles, string outputFile, MessageEventHandler message, out List<string> inputFragments)
        {
            Generator generator = new Generator();
            generator.Extensions = extensions;
            generator.InputFiles = inputFiles;
            generator.OutputFile = outputFile;
            generator.Message += message;

            bool success = generator.Generate();
            inputFragments = generator.InputFragments;
            return success;
        }
Beispiel #3
0
        /// <summary>
        /// Scan the input files for unit tests and, if specified, generate a test package source file.
        /// </summary>
        /// <param name="extensions">The WiX extensions used by the input files.</param>
        /// <param name="inputFiles">The WiX object and library files to scan for unit tests.</param>
        /// <param name="outputFile">The optional generated test package source file.</param>
        /// <param name="message">Message handler.</param>
        /// <returns>
        /// If successful, the subset of InputFiles that are fragments (i.e., are not entry sections like Product) and should be included in a test package.
        /// If there were no unit tests in the input files or a test package couldn't be created, an empty enumerable.
        /// </returns>
        public static IEnumerable<string> Generate(StringCollection extensions, List<string> inputFiles, string outputFile, MessageEventHandler message)
        {
            Generator generator = new Generator();
            generator.Extensions = extensions;
            generator.InputFiles = inputFiles;
            generator.OutputFile = outputFile;
            generator.Message += message;

            bool success = generator.Generate();
            return success ? generator.InputFragments : Enumerable.Empty<string>();
        }