Beispiel #1
0
        /// <summary>
        /// Tests setting up 2 listeners, with 1 of them listening to nonexistent events
        /// </summary>
        static void Test_Listener_RuntimeEvents_WrongListener()
        {
            SingleLoudEventListener listener1 = new SingleLoudGCEventListener("Microsoft-Windows-DotNETRuntime");
            SingleLoudEventListener listener2 = new SingleLoudEventListener("SomeOtherSource");

            // Invoke 3 GCs
            GC.Collect();
            GC.Collect();
            GC.Collect();

            listener1.VerifyMinAndReportError("Test_Listener_RuntimeEvents_ManyListener_Listener1", "GCStart_V2", 3);
            listener2.VerifyLessThanAndReportError("Test_Listener_RuntimeEvents_ManyListener_Listener2", "GCStart_V2", 1);
        }
Beispiel #2
0
        static void Test_Listener_RuntimeEvents_SimpleGC()
        {
            using (SingleLoudEventListener listener = new SingleLoudGCEventListener("Microsoft-Windows-DotNETRuntime"))
            {
                // Invoke 3 GCs
                GC.Collect();
                GC.Collect();
                GC.Collect();
                Thread.Sleep(1000);

                listener.VerifyMinAndReportError("Test_Listener_RuntimeEvents_SimpleGC_Listener1", "GCStart_V2", 3);
            }
        }
Beispiel #3
0
        static void Test_Listener_RuntimeEvents_ManyListener()
        {
            SingleLoudEventListener listener1 = new SingleLoudGCEventListener("Microsoft-Windows-DotNETRuntime");
            SingleLoudEventListener listener2 = new SingleLoudGCEventListener("Microsoft-Windows-DotNETRuntime");

            // Invoke 3 GCs
            GC.Collect();
            GC.Collect();
            GC.Collect();
            Thread.Sleep(1000);

            listener1.VerifyMinAndReportError("Test_Listener_RuntimeEvents_ManyListener_Listener1", "GCStart_V2", 3);
            listener2.VerifyMinAndReportError("Test_Listener_RuntimeEvents_ManyListener_Listener2", "GCStart_V2", 3);
        }