Example #1
0
        /*
         * Method:      ValidateHasParameter
         *
         * Validates that the given ToolTaskExtension's command line contains the indicated
         * parameter.  Returns the index of the parameter that matched.
         *
         */
        internal static int ValidateHasParameter(ToolTaskExtension t, string parameter, bool useResponseFile)
        {
            CommandLineBuilderExtension b = new CommandLineBuilderExtension();

            if (useResponseFile)
            {
                t.AddResponseFileCommands(b);
            }
            else
            {
                t.AddCommandLineCommands(b);
            }

            string cl  = b.ToString();
            string msg = String.Format("Command-line = [{0}]\r\n", cl);

            msg += String.Format(" Searching for [{0}]\r\n", parameter);

            string[] pieces = Parse(cl);

            int i = 0;

            foreach (string s in pieces)
            {
                msg += String.Format(" Parm = [{0}]\r\n", s);
                if (s == parameter)
                {
                    return(i);
                }

                i++;
            }

            msg += "Not found!\r\n";
            Console.WriteLine(msg);
            Assert.True(false, msg); // Could not find the parameter.

            return(0);
        }
Example #2
0
        internal static void ValidateDoesNotContain(ToolTaskExtension t, string lookFor, bool useResponseFile)
        {
            CommandLineBuilderExtension b = new CommandLineBuilderExtension();

            if (useResponseFile)
            {
                t.AddResponseFileCommands(b);
            }
            else
            {
                t.AddCommandLineCommands(b);
            }

            string cl  = b.ToString();
            string msg = String.Format("Command-line = [{0}]\r\n", cl);

            msg += String.Format(" Searching for [{0}]\r\n", lookFor);
            if (cl.IndexOf(lookFor) != -1)
            {
                msg += "Found!\r\n";
                Console.WriteLine(msg);
                Assert.True(false, msg);
            }
        }