public void WindowsPerformanceLiasonTest_VerifyDecrementSimple64()
        {
            WindowsPerformanceLiason underTest = new WindowsPerformanceLiason();
            float initalValue =
                underTest.NextValue(CounterTestUtilities.TestCategoryName, CounterTestUtilities.TestCounterNumberOfItems64Name);

            underTest.IncrementBy(CounterTestUtilities.TestCategoryName, CounterTestUtilities.TestCounterNumberOfItems64Name, 7);
            underTest.Decrement(CounterTestUtilities.TestCategoryName, CounterTestUtilities.TestCounterNumberOfItems64Name);
            float finalValue =
                underTest.NextValue(CounterTestUtilities.TestCategoryName, CounterTestUtilities.TestCounterNumberOfItems64Name);

            Assert.AreEqual(initalValue + 6, finalValue);
        }
        public void WindowsPerformanceLiasonTest_VerifyDecrementAverageTimer32()
        {
            WindowsPerformanceLiason underTest = new WindowsPerformanceLiason();

            underTest.Increment(CounterTestUtilities.TestCategoryName, CounterTestUtilities.TestAverageTimer32Name);
            underTest.Increment(CounterTestUtilities.TestCategoryName, CounterTestUtilities.TestAverageTimer32Name);
            underTest.Decrement(CounterTestUtilities.TestCategoryName, CounterTestUtilities.TestAverageTimer32Name);
            float finalValue =
                underTest.NextValue(CounterTestUtilities.TestCategoryName, CounterTestUtilities.TestAverageTimer32Name);
            //// ((N1 - N0) / F) / (B1 - B0)
            //// how fast is our clock
            float freq = Stopwatch.Frequency;
            //// ((N1 - N0) / F)
            float numerator   = (1 - 2) / freq;
            float denominator = 3 - 2;

            Assert.AreEqual(numerator / denominator, finalValue, .002, "Freq: " + freq);
            //// the final value is actually 0 here and our calculatd value is very small, almost -0
        }
Пример #3
0
        public void WindowsPerformanceLiasonBoundsTest_VerifyDecrementEmptyCounterCheck()
        {
            WindowsPerformanceLiason underTest = new WindowsPerformanceLiason();

            underTest.Decrement(CounterTestUtilities.TestCategoryName, string.Empty);
        }
Пример #4
0
        public void WindowsPerformanceLiasonBoundsTest_VerifyDecrementEmptyCategoryCheck()
        {
            WindowsPerformanceLiason underTest = new WindowsPerformanceLiason();

            underTest.Decrement(string.Empty, CounterTestUtilities.TestCounterNumberOfItems64Name);
        }