Exemplo n.º 1
0
        public void ParametersParsingTests()
        {
            SimulatedConsole sc = new SimulatedConsole();
            SerialConsoleLogger L = new SerialConsoleLogger(LoggerVerbosity.Normal, sc.Write, null, null);

            L.Parameters = "NoSuMmaRy";
            L.ParseParameters();
            Assertion.Assert(L.ShowSummary == false);

            L.Parameters = ";;NoSuMmaRy;";
            L.ParseParameters();
            Assertion.Assert(L.ShowSummary == false);

            sc = new SimulatedConsole();
            ParallelConsoleLogger L2 = new ParallelConsoleLogger(LoggerVerbosity.Normal, sc.Write, null, null);

            L2.Parameters = "NoSuMmaRy";
            L2.ParseParameters();
            Assertion.Assert(L2.ShowSummary == false);

            L2.Parameters = ";;NoSuMmaRy;";
            L2.ParseParameters();
            Assertion.Assert(L2.ShowSummary == false);
        }
Exemplo n.º 2
0
        public void DoNotDisplayItemListIfDisabled()
        {
            SimulatedConsole sc = new SimulatedConsole();
            SerialConsoleLogger cl = new SerialConsoleLogger(LoggerVerbosity.Diagnostic, sc.Write, null, null);
            cl.Parameters = "noitemandpropertylist";
            cl.ParseParameters();

            WriteAndValidateItems(cl, sc, false);

            sc = new SimulatedConsole();
            ParallelConsoleLogger cl2 = new ParallelConsoleLogger(LoggerVerbosity.Diagnostic, sc.Write, null, null);
            cl2.Parameters = "noitemandpropertylist";
            cl2.ParseParameters();

            WriteAndValidateItems(cl2, sc, false);
        }       
Exemplo n.º 3
0
        public void ParametersEmptyTests()
        {
            SimulatedConsole sc = new SimulatedConsole();
            SerialConsoleLogger L = new SerialConsoleLogger(LoggerVerbosity.Normal, sc.Write, null, null);

            L.Parameters = "";
            L.ParseParameters();
            Assertion.Assert(L.ShowSummary == false);

            L.Parameters = null;
            L.ParseParameters();
            Assertion.Assert(L.ShowSummary == false);

            sc = new SimulatedConsole();
            ParallelConsoleLogger cl2 = new ParallelConsoleLogger(LoggerVerbosity.Diagnostic, sc.Write, null, null);
            cl2.Parameters = "noitemandpropertylist";
            cl2.ParseParameters();

            WriteAndValidateItems(cl2, sc, false);
        }
Exemplo n.º 4
0
        public void DisplayItemsList()
        {
            SimulatedConsole sc = new SimulatedConsole();
            SerialConsoleLogger cl = new SerialConsoleLogger(LoggerVerbosity.Diagnostic, sc.Write, null, null);

            WriteAndValidateItems(cl, sc, true);

            sc = new SimulatedConsole();
            ParallelConsoleLogger cl2 = new ParallelConsoleLogger(LoggerVerbosity.Diagnostic, sc.Write, null, null);

            WriteAndValidateItems(cl2, sc, true);
        }
Exemplo n.º 5
0
        public void DoNotDisplayItemListInDetailed()
        {
            SimulatedConsole sc = new SimulatedConsole();
            SerialConsoleLogger cl = new SerialConsoleLogger(LoggerVerbosity.Detailed, sc.Write, null, null);

            WriteAndValidateItems(cl, sc, false);

            sc = new SimulatedConsole();
            ParallelConsoleLogger cl2 = new ParallelConsoleLogger(LoggerVerbosity.Detailed, sc.Write, null, null);

            WriteAndValidateItems(cl2, sc, false);
        }
Exemplo n.º 6
0
        public void WritePropertiesEmptyList()
        {
            Hashtable properties = new Hashtable();


            for (int i = 0; i < 2; i++)
            {
                BaseConsoleLogger cl = null;
                SimulatedConsole sc = new SimulatedConsole();
                if (i == 0)
                {
                    cl = new SerialConsoleLogger(LoggerVerbosity.Diagnostic, sc.Write, null, null);
                }
                else
                {
                    cl = new ParallelConsoleLogger(LoggerVerbosity.Diagnostic, sc.Write, null, null);
                }

                if (cl is SerialConsoleLogger)
                {
                    ArrayList propertyList = ((SerialConsoleLogger)cl).ExtractPropertyList(properties);
                    ((SerialConsoleLogger)cl).WriteProperties(propertyList);
                }
                else
                {
                    BuildEventArgs buildEvent = new BuildErrorEventArgs("", "", "", 0, 0, 0, 0, "", "", "");
                    buildEvent.BuildEventContext = new BuildEventContext(1, 2, 3, 4);
                    ((ParallelConsoleLogger)cl).WriteProperties(buildEvent, properties);
                }

                string log = sc.ToString();

                // There should be nothing in the log
                Assert.IsTrue(log.Length == 0, "Iteration of I: " + i);
                Console.WriteLine("Iteration of i: " + i + "[" + log + "]");
            }
        }
Exemplo n.º 7
0
        public void MultilineFormatMixedLineEndings()
        {
            string s = "foo" + "\r\n\r\n" + "bar" + "\n" + "baz" + "\n\r\n\n" +
                "jazz" + "\r\n" + "razz" + "\n\n" + "matazz" + "\n" + "end";

            SerialConsoleLogger cl = new SerialConsoleLogger();

            string ss = cl.IndentString(s, 0);

            //should convert lines to system format
            Assertion.AssertEquals("foo" + Environment.NewLine + Environment.NewLine +
                                   "bar" + Environment.NewLine +
                                   "baz" + Environment.NewLine + Environment.NewLine + Environment.NewLine +
                                   "jazz" + Environment.NewLine +
                                   "razz" + Environment.NewLine + Environment.NewLine +
                                   "matazz" + Environment.NewLine +
                                   "end" + Environment.NewLine, ss);
        }
Exemplo n.º 8
0
        public void MultilineFormatUnixLineEndings()
        {
            string s = "foo\nbar\nbaz\n";
            SerialConsoleLogger cl = new SerialConsoleLogger();

            string ss = cl.IndentString(s, 0);

            //should convert lines to system format
            Assertion.AssertEquals("foo" + Environment.NewLine +
                                   "bar" + Environment.NewLine +
                                   "baz" + Environment.NewLine + Environment.NewLine, ss); 
        }
Exemplo n.º 9
0
        public void MultilineFormatWindowsLineEndings()
        {
            string newline = "\r\n";
            string s = "foo" + newline + "bar" +
                       newline + "baz" + newline;
            SerialConsoleLogger cl = new SerialConsoleLogger();

            string ss = cl.IndentString(s, 4);

            //should convert lines to system format
            Assertion.AssertEquals("    foo" + Environment.NewLine +
                                   "    bar" + Environment.NewLine +
                                   "    baz" + Environment.NewLine + 
                                   "    " + Environment.NewLine, ss); 
        }
Exemplo n.º 10
0
        public void SingleLineFormatNoop()
        {
            string s = "foo";
            SerialConsoleLogger cl = new SerialConsoleLogger();

            string ss = cl.IndentString(s, 0);

            //should be a no-op
            Assertion.AssertEquals("foo" + Environment.NewLine, ss); 
        }