private void RaiseEvents(EventSource source) { source.RaiseBuildStartedEvent(null, buildStarted); source.RaiseProjectStartedEvent(null, projectStarted); source.RaiseTargetStartedEvent(null, targetStarted); source.RaiseTaskStartedEvent(null, taskStarted); source.RaiseMessageEvent(null, lowMessage); source.RaiseMessageEvent(null, normalMessage); source.RaiseMessageEvent(null, highMessage); source.RaiseMessageEvent(null, commandLine); source.RaiseCustomEvent(null, externalStartedEvent); source.RaiseWarningEvent(null, warning); source.RaiseErrorEvent(null, error); source.RaiseTaskFinishedEvent(null, taskFinished); source.RaiseTargetFinishedEvent(null, targetFinished); source.RaiseProjectFinishedEvent(null, projectFinished); source.RaiseBuildFinishedEvent(null, buildFinished); }
public void NullEventFieldsParallel() { EventSource es = new EventSource(); SimulatedConsole sc = new SimulatedConsole(); ConsoleLogger L = new ConsoleLogger(LoggerVerbosity.Diagnostic, sc.Write, sc.SetColor, sc.ResetColor); L.Initialize(es, 2); BuildEventContext buildEventContext = new BuildEventContext(1, 2, 3, 4); BuildStartedEventArgs bse = new BuildStartedEventArgs(null, null); bse.BuildEventContext = buildEventContext; ProjectStartedEventArgs pse = new ProjectStartedEventArgs(-1, null, null, "p", null, null, null, buildEventContext); pse.BuildEventContext = buildEventContext; TargetStartedEventArgs trse = new TargetStartedEventArgs(null, null, "t", null, null); trse.BuildEventContext = buildEventContext; TaskStartedEventArgs tase = new TaskStartedEventArgs(null, null, null, null, "task"); tase.BuildEventContext = buildEventContext; BuildMessageEventArgs bmea = new BuildMessageEventArgs(null, null, null, MessageImportance.High); bmea.BuildEventContext = buildEventContext; BuildWarningEventArgs bwea = new BuildWarningEventArgs(null, null, null, 0, 0, 0, 0, null, null, null); bwea.BuildEventContext = buildEventContext; BuildErrorEventArgs beea = new BuildErrorEventArgs(null, null, null, 0, 0, 0, 0, null, null, null); beea.BuildEventContext = buildEventContext; TaskFinishedEventArgs trfea = new TaskFinishedEventArgs(null, null, null, null, "task", true); trfea.BuildEventContext = buildEventContext; TargetFinishedEventArgs tafea = new TargetFinishedEventArgs(null, null, "t", null, null, true); tafea.BuildEventContext = buildEventContext; ProjectFinishedEventArgs pfea = new ProjectFinishedEventArgs(null, null, "p", true); pfea.BuildEventContext = buildEventContext; BuildFinishedEventArgs bfea = new BuildFinishedEventArgs(null, null, true); bfea.BuildEventContext = buildEventContext; MyCustomBuildEventArgs2 mcea = new MyCustomBuildEventArgs2(); mcea.BuildEventContext = buildEventContext; // Not all parameters are null here, but that's fine, we assume the engine will never // fire a ProjectStarted without a project name, etc. es.RaiseBuildStartedEvent(null, bse); es.RaiseProjectStartedEvent(null, pse); es.RaiseTargetStartedEvent(null, trse); es.RaiseTaskStartedEvent(null, tase); es.RaiseMessageEvent(null, bmea); es.RaiseWarningEvent(null, bwea); es.RaiseErrorEvent(null, beea); es.RaiseTaskFinishedEvent(null, trfea); es.RaiseTargetFinishedEvent(null, tafea); es.RaiseProjectFinishedEvent(null, pfea); es.RaiseBuildFinishedEvent(null, bfea); es.RaiseAnyEvent(null, bfea); es.RaiseStatusEvent(null, bfea); es.RaiseCustomEvent(null, mcea); // No exception raised }
public void NullEventFields() { EventSource es = new EventSource(); SimulatedConsole sc = new SimulatedConsole(); ConsoleLogger L = new ConsoleLogger(LoggerVerbosity.Diagnostic, sc.Write, sc.SetColor, sc.ResetColor); L.Initialize(es); // Not all parameters are null here, but that's fine, we assume the engine will never // fire a ProjectStarted without a project name, etc. es.RaiseBuildStartedEvent(null, new BuildStartedEventArgs(null, null)); es.RaiseProjectStartedEvent(null, new ProjectStartedEventArgs(null, null, "p", null, null, null)); es.RaiseTargetStartedEvent(null, new TargetStartedEventArgs(null, null, "t", null, null)); es.RaiseTaskStartedEvent(null, new TaskStartedEventArgs(null, null, null, null, "task")); es.RaiseMessageEvent(null, new BuildMessageEventArgs(null, null, null, MessageImportance.High)); es.RaiseWarningEvent(null, new BuildWarningEventArgs(null, null, null, 0, 0, 0, 0, null, null, null)); es.RaiseErrorEvent(null, new BuildErrorEventArgs(null, null, null, 0, 0, 0, 0, null, null, null)); es.RaiseTaskFinishedEvent(null, new TaskFinishedEventArgs(null, null, null, null, "task", true)); es.RaiseTargetFinishedEvent(null, new TargetFinishedEventArgs(null, null, "t", null, null, true)); es.RaiseProjectFinishedEvent(null, new ProjectFinishedEventArgs(null, null, "p", true)); es.RaiseBuildFinishedEvent(null, new BuildFinishedEventArgs(null, null, true)); es.RaiseAnyEvent(null, new BuildFinishedEventArgs(null, null, true)); es.RaiseStatusEvent(null, new BuildFinishedEventArgs(null, null, true)); es.RaiseCustomEvent(null, new MyCustomBuildEventArgs2()); // No exception raised }
public void CustomNotDisplayedAtNormal() { EventSource es = new EventSource(); SimulatedConsole sc = new SimulatedConsole(); ConsoleLogger L = new ConsoleLogger(LoggerVerbosity.Normal, sc.Write, null, null); L.Initialize(es); MyCustomBuildEventArgs c = new MyCustomBuildEventArgs("msg"); es.RaiseCustomEvent(null, c); Assertion.AssertEquals(String.Empty, sc.ToString()); }
public void CustomDisplayedAtDiagnosticMP() { EventSource es = new EventSource(); SimulatedConsole sc = new SimulatedConsole(); ConsoleLogger L = new ConsoleLogger(LoggerVerbosity.Diagnostic, sc.Write, null, null); L.Initialize(es,2); MyCustomBuildEventArgs c = new MyCustomBuildEventArgs("msg"); c.BuildEventContext = new BuildEventContext(1, 1, 1, 1); es.RaiseCustomEvent(null, c); Assertion.Assert(sc.ToString().Contains("msg")); }
public void CustomDisplayedAtDetailed() { EventSource es = new EventSource(); SimulatedConsole sc = new SimulatedConsole(); ConsoleLogger L = new ConsoleLogger(LoggerVerbosity.Detailed, sc.Write, null, null); L.Initialize(es); MyCustomBuildEventArgs c = new MyCustomBuildEventArgs("msg"); es.RaiseCustomEvent(null, c); Assertion.AssertEquals("msg" + Environment.NewLine, sc.ToString()); }