public void MockETWProcessorTriggersEndEventWithSessionNameAndEventCount()
        {
            const string anySessionName = "session";
            const long anyEventCount = 42;
            bool eventTriggered = false;

            using (var processor = new MockETWProcessor(anySessionName))
            {
                processor.EventProcessed += ev => { };
                processor.SessionEnd += (name, end, count, lostCount, unreadableCount) =>
                                        {
                                            Assert.AreEqual(anySessionName, name);
                                            Assert.AreEqual(anyEventCount, count);
                                            eventTriggered = true;
                                        };
                processor.ProcessAsync();
                for (int i = 0; i < anyEventCount; ++i)
                {
                    processor.InjectEvent(new ETWEvent(DateTime.Now, Guid.Empty, string.Empty, 0, string.Empty, 0,
                                                       EventKeywords.None,
                                                       EventLevel.Verbose, EventOpcode.Info, Guid.Empty, 0, 0, null));
                }
                processor.StopProcessing();
                Assert.IsTrue(eventTriggered);
            }
        }
        public void MockETWProcessorTriggersForSubscribedEventSources()
        {
            const string anySessionName = "session";
            bool eventTriggered = false;

            using (var processor = new MockETWProcessor(anySessionName))
            {
                processor.EventProcessed += ev => eventTriggered = true;
                processor.SubscribeToEvents(TestLogger.Write, EventLevel.Verbose);

                processor.ProcessAsync();
                TestLogger.Write.String("Hi");
                processor.StopProcessing();
                Assert.IsTrue(eventTriggered);
            }
        }
        public void MockETWProcessorTriggersStartEventWithSessionName()
        {
            const string anySessionName = "session";
            bool eventTriggered = false;

            using (var processor = new MockETWProcessor(anySessionName))
            {
                processor.SessionStart += (name, start) =>
                                          {
                                              Assert.AreEqual(anySessionName, name);
                                              eventTriggered = true;
                                          };
                processor.ProcessAsync();
                processor.StopProcessing();
                Assert.IsTrue(eventTriggered);
            }
        }
        public void MockETWProcessorTriggersEventProcessedWithSameETWEventObjectPassedToInjectEvent()
        {
            const string anySessionName = "session";
            var anyEvent = new ETWEvent(DateTime.Now, Guid.Empty, string.Empty, 0, string.Empty, 0, EventKeywords.None,
                                        EventLevel.Verbose, EventOpcode.Info, Guid.Empty, 0, 0, null);
            bool eventTriggered = false;

            using (var processor = new MockETWProcessor(anySessionName))
            {
                processor.EventProcessed += ev =>
                                            {
                                                Assert.AreSame(anyEvent, ev);
                                                eventTriggered = true;
                                            };
                processor.ProcessAsync();
                processor.InjectEvent(anyEvent);
                processor.StopProcessing();
                Assert.IsTrue(eventTriggered);
            }
        }