Renaming 'failure' in counter tests (#23891)
authorSung Yoon Whang <suwhang@microsoft.com>
Thu, 11 Apr 2019 11:52:48 +0000 (04:52 -0700)
committerGitHub <noreply@github.com>
Thu, 11 Apr 2019 11:52:48 +0000 (04:52 -0700)
tests/src/tracing/eventcounter/incrementingpollingcounter.cs
tests/src/tracing/eventcounter/pollingcounter.cs

index 2b21ebb..d838087 100644 (file)
@@ -19,11 +19,11 @@ namespace BasicEventSourceTests
         [EventSource(Name = "SimpleEventSource")]
         private sealed class SimpleEventSource : EventSource
         {
-            private object _failureCounter;
+            private object _mockedCounter;
 
-            public SimpleEventSource(Func<double> getFailureCount, Type IncrementingPollingCounterType)
+            public SimpleEventSource(Func<double> getMockedCount, Type IncrementingPollingCounterType)
             {
-                _failureCounter = Activator.CreateInstance(IncrementingPollingCounterType, "failureCount", this, getFailureCount);    
+                _mockedCounter = Activator.CreateInstance(IncrementingPollingCounterType, "failureCount", this, getMockedCount);    
             }
         }
 
@@ -91,12 +91,12 @@ namespace BasicEventSourceTests
         }
 
 
-        public static int failureCountCalled = 0;
+        public static int mockedCountCalled = 0;
 
-        public static double getFailureCount()
+        public static double getMockedCount()
         {
-            failureCountCalled++;
-            return failureCountCalled;
+            mockedCountCalled++;
+            return mockedCountCalled;
         }
         public static int Main(string[] args)
         {
@@ -117,12 +117,12 @@ namespace BasicEventSourceTests
                     return 1;
                 }
 
-                SimpleEventSource eventSource = new SimpleEventSource(getFailureCount, IncrementingPollingCounterType);
+                SimpleEventSource eventSource = new SimpleEventSource(getMockedCount, IncrementingPollingCounterType);
 
                 // Want to sleep for 5000 ms to get some counters piling up.
                 Thread.Sleep(5000);
 
-                if (!myListener.Failed && failureCountCalled > 0)
+                if (!myListener.Failed && mockedCountCalled > 0)
                 {
                     Console.WriteLine("Test Passed");
                     return 100;    
index 9e8dff2..de50ff4 100644 (file)
@@ -22,10 +22,10 @@ namespace BasicEventSourceTests
             private object _failureCounter;
             private object _successCounter;
 
-            public SimpleEventSource(Func<double> getFailureCount, Func<double> getSuccessCount, Type PollingCounterType)
+            public SimpleEventSource(Func<double> getMockedCount, Func<double> getSuccessCount, Type PollingCounterType)
             {
                 _failureCounter = Activator.CreateInstance(PollingCounterType, "failureCount", this, getSuccessCount);
-                _successCounter = Activator.CreateInstance(PollingCounterType, "successCount", this, getFailureCount);
+                _successCounter = Activator.CreateInstance(PollingCounterType, "successCount", this, getMockedCount);
             }
         }
 
@@ -112,9 +112,9 @@ namespace BasicEventSourceTests
                         }
                         else if (name.Equals("successCount"))
                         {
-                            if (Int32.Parse(mean) != failureCountCalled)
+                            if (Int32.Parse(mean) != mockedCountCalled)
                             {
-                                Console.WriteLine($"Mean is not what we expected: {mean} vs {failureCountCalled}");
+                                Console.WriteLine($"Mean is not what we expected: {mean} vs {mockedCountCalled}");
                             }
                         }
 
@@ -137,13 +137,13 @@ namespace BasicEventSourceTests
         }
 
 
-        public static int failureCountCalled = 0;
+        public static int mockedCountCalled = 0;
         public static int successCountCalled = 0;
 
-        public static double getFailureCount()
+        public static double getMockedCount()
         {
-            failureCountCalled++;
-            return failureCountCalled;
+            mockedCountCalled++;
+            return mockedCountCalled;
         }
 
         public static double getSuccessCount()
@@ -171,12 +171,12 @@ namespace BasicEventSourceTests
                     return 1;
                 }
 
-                SimpleEventSource eventSource = new SimpleEventSource(getFailureCount, getSuccessCount, PollingCounterType);
+                SimpleEventSource eventSource = new SimpleEventSource(getMockedCount, getSuccessCount, PollingCounterType);
 
                 // Want to sleep for 5000 ms to get some counters piling up.
                 Thread.Sleep(5000);
 
-                if (myListener.FailureEventCount > 0 && myListener.SuccessEventCount > 0 && !myListener.Failed && (failureCountCalled > 0 && successCountCalled > 0))
+                if (myListener.FailureEventCount > 0 && myListener.SuccessEventCount > 0 && !myListener.Failed && (mockedCountCalled > 0 && successCountCalled > 0))
                 {
                     Console.WriteLine("Test Passed");
                     return 100;