Ejemplo n.º 1
0
        public void LogEventsFromTextOutput(string lineText, LogEvent expected)
        {
            var task = new LogEventsFromTextOutputToolTask();

            task.LogEventsFromTextOutput(lineText);
            Assert.AreEqual(task.LogEvents.Count, 1);
            var result = task.LogEvents[0];

            task.LogEvents.Clear();

            if (result != null && result.Origin == task.GetType().Name.ToUpper())
            {
                result.Origin = "#TASKNAME";
            }

            if (expected == null)
            {
                Assert.IsNull(result, "#nomatch");
                return;
            }

            Assert.IsNotNull(result, "#match");
            Assert.AreEqual(expected.Origin, result.Origin, "#origin");
            Assert.AreEqual(expected.Line, result.Line, "#line");
            Assert.AreEqual(expected.Column, result.Column, "#column");
            Assert.AreEqual(expected.EndLine, result.EndLine, "#endline");
            Assert.AreEqual(expected.EndColumn, result.EndColumn, "#endcolumn");
            Assert.AreEqual(expected.IsError, result.IsError, "#iserror");
            Assert.AreEqual(expected.Subcategory ?? "", result.Subcategory, "#subcategory");
            Assert.AreEqual(expected.Code, result.Code, "number");
            Assert.AreEqual(expected.Message ?? "", result.Message, "#message");
        }
Ejemplo n.º 2
0
		public void LogEventsFromTextOutput (string lineText, LogEvent expected)
		{
			var task = new LogEventsFromTextOutputToolTask ();
			task.LogEventsFromTextOutput (lineText);
			Assert.AreEqual (task.LogEvents.Count, 1);
			var result = task.LogEvents[0];
			task.LogEvents.Clear ();

			if (result != null && result.Origin == task.GetType ().Name.ToUpper ())
				result.Origin = "#TASKNAME";

			if (expected == null) {
				Assert.IsNull (result, "#nomatch");
				return;
			}

			Assert.IsNotNull (result, "#match");
			Assert.AreEqual (expected.Origin, result.Origin, "#origin");
			Assert.AreEqual (expected.Line, result.Line, "#line");
			Assert.AreEqual (expected.Column, result.Column, "#column");
			Assert.AreEqual (expected.EndLine, result.EndLine, "#endline");
			Assert.AreEqual (expected.EndColumn, result.EndColumn, "#endcolumn");
			Assert.AreEqual (expected.IsError, result.IsError, "#iserror");
			Assert.AreEqual (expected.Subcategory ?? "", result.Subcategory, "#subcategory");
			Assert.AreEqual (expected.Code, result.Code, "number");
			Assert.AreEqual (expected.Message ?? "", result.Message, "#message");
		}
Ejemplo n.º 3
0
		public void LogEventsFromTextOutput ()
		{
			var messages = new[] {
				new {Code = "CS0152", Line = "class1.cs(16,4): error CS0152: The label `case 1:' already occurs in this switch statement" },
			};

			var task = new LogEventsFromTextOutputToolTask ();
			foreach (var m in messages) {
				task.LogEventsFromTextOutput (m.Line);
				Assert.IsTrue (task.Codes.Count > 0, "No error logged for line: {0}", m.Line);
				Assert.AreEqual (m.Code, task.Codes [0]);
				task.Codes.Clear ();
			}
		}
Ejemplo n.º 4
0
        public void LogEventsFromTextOutput()
        {
            var messages = new[] {
                new { Code = "CS0152", Line = "class1.cs(16,4): error CS0152: The label `case 1:' already occurs in this switch statement" },
            };

            var task = new LogEventsFromTextOutputToolTask();

            foreach (var m in messages)
            {
                task.LogEventsFromTextOutput(m.Line);
                Assert.IsTrue(task.Codes.Count > 0, "No error logged for line: {0}", m.Line);
                Assert.AreEqual(m.Code, task.Codes [0]);
                task.Codes.Clear();
            }
        }