示例#1
0
        public void EventSourceExistsWhenDistributedServicePaused()
        {
            DistributorEventLogger eventLogger = new DistributorEventLogger(EventSourceName);

            eventLogger.LogServicePaused();

            Assert.IsTrue(EventLog.SourceExists(eventLogger.EventSource));
        }
示例#2
0
        public void ServicePausedWritesToEventLog()
        {
            DistributorEventLogger logger = new DistributorEventLogger();

            using (var eventLog = new EventLogTracker(GetEventLog()))
            {
                logger.LogServicePaused();

                Assert.AreEqual(1, eventLog.NewEntries().Count(ev => EventIsFromLogger(ev, logger)));
            }

            using (var eventLog = new EventLogTracker(GetEventLog()))
            {
                logger.LogServicePaused();

                Assert.AreEqual(1, eventLog.NewEntries().Count(ev => EventIsFromLogger(ev, logger)));
            }
        }
        public void ServicePausedWritesToEventLog()
        {
            DistributorEventLogger logger = new DistributorEventLogger(TestApplicationName);

            using (EventLog eventLog = GetEventLog())
            {
                int eventCount = eventLog.Entries.Count;
                logger.LogServicePaused();
                Assert.AreEqual(eventCount + 1, eventLog.Entries.Count);
            }
        }
        public void ServicePausedFiresWmiEvent()
        {
            DistributorEventLogger logger = new DistributorEventLogger(TestApplicationName);

            using (WmiEventWatcher eventListener = new WmiEventWatcher(1))
            {
                logger.LogServicePaused();
                eventListener.WaitForEvents();
                Assert.AreEqual(1, eventListener.EventsReceived.Count);
                Assert.AreEqual("DistributorServiceLifecycleEvent", eventListener.EventsReceived[0].ClassPath.ClassName);
                Assert.AreEqual(false, eventListener.EventsReceived[0].GetPropertyValue("Started"));
            }
        }