public void TestConsumeNullBuildEvent()
 {
     Assert.Throws<InternalErrorException>(() =>
     {
         BuildEventArgTransportSink transportSink = new BuildEventArgTransportSink(PacketProcessor);
         transportSink.Consume(null, 0);
     }
    );
 }
        public void TestConsumeMessageBuildEvent()
        {
            bool wentInHandler = false;
            BuildMessageEventArgs messageEvent = new BuildMessageEventArgs("My message", "Help me keyword", "Sender", MessageImportance.High);
            SendDataDelegate transportDelegate = delegate (INodePacket packet)
                                                 {
                                                     wentInHandler = true;
                                                     LogMessagePacket loggingPacket = packet as LogMessagePacket;
                                                     Assert.NotNull(loggingPacket);
                                                     BuildMessageEventArgs messageEventFromPacket = loggingPacket.NodeBuildEvent.Value.Value as BuildMessageEventArgs;
                                                     Assert.Equal(messageEventFromPacket, messageEvent);
                                                 };

            BuildEventArgTransportSink transportSink = new BuildEventArgTransportSink(transportDelegate);
            transportSink.Consume(messageEvent, 0);
            Assert.True(wentInHandler); // "Expected to go into transport delegate"
        }
        public void TestConsumeBuildStartedEvent()
        {
            bool wentInHandler = false;
            BuildStartedEventArgs buildStarted = new BuildStartedEventArgs("Start", "Help");
            SendDataDelegate transportDelegate = delegate (INodePacket packet)
            {
                wentInHandler = true;
            };

            BuildEventArgTransportSink transportSink = new BuildEventArgTransportSink(transportDelegate);
            transportSink.Consume(buildStarted, 0);
            Assert.True(transportSink.HaveLoggedBuildStartedEvent);
            Assert.False(transportSink.HaveLoggedBuildFinishedEvent);
            Assert.False(wentInHandler); // "Expected not to go into transport delegate"
        }
 public void TestConsumeNullBuildEvent()
 {
     BuildEventArgTransportSink transportSink = new BuildEventArgTransportSink(PacketProcessor);
     transportSink.Consume(null, 0);
 }