Example #1
0
        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
        }
Example #2
0
        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
        }