public void GetandSetLoggerParameters()
        {
            CentralForwardingLogger centralLogger = new CentralForwardingLogger();

            // Verify NodeId can be get and set properly
            Assert.Equal(0, centralLogger.NodeId);
            centralLogger.NodeId = 4;
            Assert.Equal(4, centralLogger.NodeId);

            // Verify Parameters can be get and set properly
            Assert.True(string.IsNullOrEmpty(centralLogger.Parameters)); // "Expected parameters to be null or empty"
            centralLogger.Parameters = "MyParameters";
            Assert.Equal("MyParameters", centralLogger.Parameters);      // "Expected parameters equal MyParameters"

            // Verify Verbosity can be get and set properly
            Assert.Equal(LoggerVerbosity.Quiet, centralLogger.Verbosity);    // "Expected default to be Quiet"
            centralLogger.Verbosity = LoggerVerbosity.Detailed;
            Assert.Equal(LoggerVerbosity.Detailed, centralLogger.Verbosity); // "Expected default to be Detailed"

            // Verify BuildEventRedirector can be get and set properly
            Assert.Null(centralLogger.BuildEventRedirector); // "Expected BuildEventRedirector to be null"
            TestEventRedirector eventRedirector = new TestEventRedirector(null);

            centralLogger.BuildEventRedirector = eventRedirector;
            Assert.Equal(centralLogger.BuildEventRedirector, eventRedirector); // "Expected the BuildEventRedirector to match the passed in eventRedirector"
        }
Example #2
0
        public void GetandSetLoggerParameters()
        {
            CentralForwardingLogger centralLogger = new CentralForwardingLogger();

            // Verify NodeId can be get and set properly
            Assert.AreEqual(0, centralLogger.NodeId);
            centralLogger.NodeId = 4;
            Assert.AreEqual(4, centralLogger.NodeId);

            // Verify Parameters can be get and set properly
            Assert.IsTrue(string.IsNullOrEmpty(centralLogger.Parameters), "Expected parameters to be null or empty");
            centralLogger.Parameters = "MyParameters";
            Assert.IsTrue(string.Compare(centralLogger.Parameters, "MyParameters", StringComparison.OrdinalIgnoreCase) == 0, "Expected parameters equal MyParameters");

            // Verify Verbosity can be get and set properly
            Assert.IsTrue(centralLogger.Verbosity == LoggerVerbosity.Quiet, "Expected default to be Quiet");
            centralLogger.Verbosity = LoggerVerbosity.Detailed;
            Assert.IsTrue(centralLogger.Verbosity == LoggerVerbosity.Detailed, "Expected default to be Detailed");

            // Verify BuildEventRedirector can be get and set properly
            Assert.IsNull(centralLogger.BuildEventRedirector, "Expected BuildEventRedirector to be null");
            TestEventRedirector eventRedirector = new TestEventRedirector(null);

            centralLogger.BuildEventRedirector = eventRedirector;
            Assert.IsTrue(centralLogger.BuildEventRedirector == eventRedirector, "Expected the BuildEventRedirector to match the passed in eventRedirector");
        }
 public void InitializeWithNullEventSourceINodeLogger()
 {
     Assert.Throws <InternalErrorException>(() =>
     {
         CentralForwardingLogger centralLogger = new CentralForwardingLogger();
         centralLogger.Initialize(null, 4);
     }
                                            );
 }
        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);
        }
        /// <summary>
        /// Create a new forwarding logger, event redirector, and event source.
        /// The returned event source can then have and event raised on it and it can
        /// check to see if the event raised matches the one we were expecting.
        /// </summary>
        /// <param name="buildEventToCheck">A build event we are expecting to be forwarded by the forwarding logger</param>
        /// <returns>An event source on which one can raise an event.</returns>
        private static EventSourceSink AttachForwardingLoggerAndRedirector(BuildEventArgs buildEventToCheck)
        {
            EventSourceSink         loggerEventSource = new EventSourceSink();
            CentralForwardingLogger forwardingLogger  = new CentralForwardingLogger();
            TestEventRedirector     eventRedirector   = new TestEventRedirector(buildEventToCheck);

            forwardingLogger.BuildEventRedirector = eventRedirector;
            forwardingLogger.Initialize(loggerEventSource);
            return(loggerEventSource);
        }
        public void TestShutDown()
        {
            CentralForwardingLogger centralLogger = new CentralForwardingLogger();

            centralLogger.BuildEventRedirector = new TestEventRedirector(null);

            Assert.NotNull(centralLogger.BuildEventRedirector);

            centralLogger.Shutdown();
            Assert.Null(centralLogger.BuildEventRedirector);
        }
Example #7
0
        public void InitializeWithNullEventSourceINodeLogger()
        {
            CentralForwardingLogger centralLogger = new CentralForwardingLogger();

            centralLogger.Initialize(null, 4);
        }