public void ForwardEvents()
        {
            BuildStartedEventArgs  buildStarted  = new BuildStartedEventArgs("Message", "Help");
            BuildFinishedEventArgs buildFinished = new BuildFinishedEventArgs("Message", "Keyword", true);
            BuildMessageEventArgs  normalMessage = new BuildMessageEventArgs("Message2", "help", "sender", MessageImportance.Normal);

            EventSourceSink loggerSource = AttachForwardingLoggerAndRedirector(buildStarted);

            loggerSource.Consume(buildStarted);

            loggerSource = AttachForwardingLoggerAndRedirector(buildFinished);
            loggerSource.Consume(buildFinished);

            loggerSource = AttachForwardingLoggerAndRedirector(normalMessage);
            loggerSource.Consume(normalMessage);
        }
        public void RaiseEventWithNoBuildEventRedirector()
        {
            BuildMessageEventArgs   normalMessage    = new BuildMessageEventArgs("Message2", "help", "sender", MessageImportance.Normal);
            EventSourceSink         loggerSource     = new EventSourceSink();
            CentralForwardingLogger forwardingLogger = new CentralForwardingLogger();

            forwardingLogger.Initialize(loggerSource);
            loggerSource.Consume(normalMessage);
        }
Exemple #3
0
 /// <summary>
 /// Raise a build event on the event source
 /// </summary>
 internal void RaiseBuildEvent(BuildEventArgs buildEvent)
 {
     _sourceForEvents.Consume(buildEvent);
     if (buildEvent is BuildStartedEventArgs)
     {
         Assert.IsTrue(_sourceForEvents.HaveLoggedBuildStartedEvent);
         _sourceForEvents.HaveLoggedBuildStartedEvent = false;
         Assert.IsFalse(_sourceForEvents.HaveLoggedBuildStartedEvent);
     }
     else if (buildEvent is BuildFinishedEventArgs)
     {
         Assert.IsTrue(_sourceForEvents.HaveLoggedBuildFinishedEvent);
         _sourceForEvents.HaveLoggedBuildFinishedEvent = false;
         Assert.IsFalse(_sourceForEvents.HaveLoggedBuildFinishedEvent);
     }
 }
 private void RaiseEvents(EventSourceSink source)
 {
     source.Consume(_buildStarted);
     source.Consume(_projectStarted);
     source.Consume(_targetStarted);
     source.Consume(_taskStarted);
     source.Consume(_lowMessage);
     source.Consume(_normalMessage);
     source.Consume(_highMessage);
     source.Consume(_commandLine);
     source.Consume(_externalStartedEvent);
     source.Consume(_warning);
     source.Consume(_error);
     source.Consume(_taskFinished);
     source.Consume(_targetFinished);
     source.Consume(_projectFinished);
     source.Consume(_buildFinished);
 }