Beispiel #1
0
        public void RollingNumber_CreatesBuckets()
        {
            MockedTime time = new MockedTime();

            try
            {
                HystrixRollingNumber counter = new HystrixRollingNumber(time, 200, 10);
                // confirm the initial settings
                Assert.AreEqual(200, counter.TimeInMilliseconds);
                Assert.AreEqual(10, counter.NumberOfBuckets);
                Assert.AreEqual(20, counter.BucketSizeInMilliseconds);

                // we start out with 0 buckets in the queue
                Assert.AreEqual(0, counter.Buckets.Size);

                // add a success in each interval which should result in all 10 buckets being created with 1 success in each
                for (int i = 0; i < counter.NumberOfBuckets; i++)
                {
                    counter.Increment(HystrixRollingNumberEvent.Success);
                    time.Increment(counter.BucketSizeInMilliseconds);
                }

                // confirm we have all 10 buckets
                Assert.AreEqual(10, counter.Buckets.Size);

                // add 1 more and we should still only have 10 buckets since that's the max
                counter.Increment(HystrixRollingNumberEvent.Success);
                Assert.AreEqual(10, counter.Buckets.Size);
            }
            catch (Exception e)
            {
                TestContext.WriteLine(e.ToString());
                Assert.Fail("Exception: " + e.Message);
            }
        }
Beispiel #2
0
        public void RollingNumber_EmptyBucketsFillIn()
        {
            MockedTime time = new MockedTime();

            try
            {
                HystrixRollingNumber counter = new HystrixRollingNumber(time, 200, 10);

                // add 1
                counter.Increment(HystrixRollingNumberEvent.Success);

                // we should have 1 bucket
                Assert.AreEqual(1, counter.Buckets.Size);

                // wait past 3 bucket time periods (the 1st bucket then 2 empty ones)
                time.Increment(counter.BucketSizeInMilliseconds * 3);

                // add another
                counter.Increment(HystrixRollingNumberEvent.Success);

                // we should have 4 (1 + 2 empty + 1 new one) buckets
                Assert.AreEqual(4, counter.Buckets.Size);
            }
            catch (Exception e)
            {
                TestContext.WriteLine(e.ToString());
                Assert.Fail("Exception: " + e.Message);
            }
        }
        public void TestEmptyBucketsFillIn()
        {
            var time = new MockedTime();

            try
            {
                var counter = new HystrixRollingNumber(time, 200, 10);

                // add 1
                counter.Increment(HystrixRollingNumberEvent.SUCCESS);

                // we should have 1 bucket
                Assert.Equal(1, counter._buckets.Size);

                // wait past 3 bucket time periods (the 1st bucket then 2 empty ones)
                time.Increment(counter._bucketSizeInMillseconds * 3);

                // add another
                counter.Increment(HystrixRollingNumberEvent.SUCCESS);

                // we should have 4 (1 + 2 empty + 1 new one) buckets
                Assert.Equal(4, counter._buckets.Size);
            }
            catch (Exception e)
            {
                output.WriteLine(e.ToString());
                Assert.True(false, "Exception: " + e.Message);
            }
        }
Beispiel #4
0
        public void RollingNumber_CumulativeCounterAfterRollingAndReset3()
        {
            MockedTime time = new MockedTime();
            HystrixRollingNumberEvent type    = HystrixRollingNumberEvent.Success;
            HystrixRollingNumber      counter = new HystrixRollingNumber(time, 20, 2);

            Assert.AreEqual(0, counter.GetCumulativeSum(type));

            counter.Increment(type);
            counter.Increment(type);
            counter.Increment(type);

            // iterate over 20 buckets on a queue sized for 2
            for (int i = 0; i < 20; i++)
            {
                try
                {
                    time.Increment(counter.BucketSizeInMilliseconds);
                }
                catch (Exception)
                {
                    // ignore
                }
            }

            // since we are rolling over the buckets it should reset naturally

            // no increments during the loop, just some before and after
            counter.Increment(type);
            counter.Increment(type);

            // cumulative count should be 5 regardless of buckets rolling
            Assert.AreEqual(5, counter.GetCumulativeSum(type));
        }
        public void TestResetBuckets()
        {
            var time = new MockedTime();

            try
            {
                var counter = new HystrixRollingNumber(time, 200, 10);

                // we start out with 0 buckets in the queue
                Assert.Equal(0, counter._buckets.Size);

                // add 1
                counter.Increment(HystrixRollingNumberEvent.SUCCESS);

                // confirm we have 1 bucket
                Assert.Equal(1, counter._buckets.Size);

                // confirm we still have 1 bucket
                Assert.Equal(1, counter._buckets.Size);

                // add 1
                counter.Increment(HystrixRollingNumberEvent.SUCCESS);

                // we should now have a single bucket with no values in it instead of 2 or more buckets
                Assert.Equal(1, counter._buckets.Size);
            }
            catch (Exception e)
            {
                output.WriteLine(e.ToString());
                Assert.True(false, "Exception: " + e.Message);
            }
        }
Beispiel #6
0
        public void RollingNumber_ResetBuckets()
        {
            MockedTime time = new MockedTime();

            try
            {
                HystrixRollingNumber counter = new HystrixRollingNumber(time, 200, 10);

                // we start out with 0 buckets in the queue
                Assert.AreEqual(0, counter.Buckets.Size);

                // add 1
                counter.Increment(HystrixRollingNumberEvent.Success);

                // confirm we have 1 bucket
                Assert.AreEqual(1, counter.Buckets.Size);

                // confirm we still have 1 bucket
                Assert.AreEqual(1, counter.Buckets.Size);

                // add 1
                counter.Increment(HystrixRollingNumberEvent.Success);

                // we should now have a single bucket with no values in it instead of 2 or more buckets
                Assert.AreEqual(1, counter.Buckets.Size);
            }
            catch (Exception e)
            {
                TestContext.WriteLine(e.ToString());
                Assert.Fail("Exception: " + e.Message);
            }
        }
Beispiel #7
0
        public void RollingNumber_CumulativeCounterAfterRolling()
        {
            MockedTime time = new MockedTime();
            HystrixRollingNumberEvent type    = HystrixRollingNumberEvent.Success;
            HystrixRollingNumber      counter = new HystrixRollingNumber(time, 20, 2);

            Assert.AreEqual(0, counter.GetCumulativeSum(type));

            // iterate over 20 buckets on a queue sized for 2
            for (int i = 0; i < 20; i++)
            {
                // first bucket
                counter.Increment(type);
                try
                {
                    time.Increment(counter.BucketSizeInMilliseconds);
                }
                catch (Exception)
                {
                    // ignore
                }

                Assert.AreEqual(2, counter.GetValues(type).Length);

                counter.GetValueOfLatestBucket(type);
            }

            // cumulative count should be 20 (for the number of loops above) regardless of buckets rolling
            Assert.AreEqual(20, counter.GetCumulativeSum(type));
        }
Beispiel #8
0
        public void RollingNumber_IncrementInSingleBucket()
        {
            MockedTime time = new MockedTime();

            try
            {
                HystrixRollingNumber counter = new HystrixRollingNumber(time, 200, 10);

                // increment
                counter.Increment(HystrixRollingNumberEvent.Success);
                counter.Increment(HystrixRollingNumberEvent.Success);
                counter.Increment(HystrixRollingNumberEvent.Success);
                counter.Increment(HystrixRollingNumberEvent.Success);
                counter.Increment(HystrixRollingNumberEvent.Failure);
                counter.Increment(HystrixRollingNumberEvent.Failure);
                counter.Increment(HystrixRollingNumberEvent.Timeout);

                // we should have 1 bucket
                Assert.AreEqual(1, counter.Buckets.Size);

                // the count should be 4
                Assert.AreEqual(4, counter.Buckets.GetLast().GetAdder(HystrixRollingNumberEvent.Success).Sum());
                Assert.AreEqual(2, counter.Buckets.GetLast().GetAdder(HystrixRollingNumberEvent.Failure).Sum());
                Assert.AreEqual(1, counter.Buckets.GetLast().GetAdder(HystrixRollingNumberEvent.Timeout).Sum());
            }
            catch (Exception e)
            {
                TestContext.WriteLine(e.ToString());
                Assert.Fail("Exception: " + e.Message);
            }
        }
Beispiel #9
0
        public void TestIncrementInSingleBucket()
        {
            MockedTime time = new MockedTime();

            try
            {
                HystrixRollingNumber counter = new HystrixRollingNumber(time, 200, 10);

                // Increment
                counter.Increment(HystrixRollingNumberEvent.SUCCESS);
                counter.Increment(HystrixRollingNumberEvent.SUCCESS);
                counter.Increment(HystrixRollingNumberEvent.SUCCESS);
                counter.Increment(HystrixRollingNumberEvent.SUCCESS);
                counter.Increment(HystrixRollingNumberEvent.FAILURE);
                counter.Increment(HystrixRollingNumberEvent.FAILURE);
                counter.Increment(HystrixRollingNumberEvent.TIMEOUT);

                // we should have 1 bucket
                Assert.Equal(1, counter._buckets.Size);

                // the count should be 4
                Assert.Equal(4, counter._buckets.Last.GetAdder(HystrixRollingNumberEvent.SUCCESS).Sum());
                Assert.Equal(2, counter._buckets.Last.GetAdder(HystrixRollingNumberEvent.FAILURE).Sum());
                Assert.Equal(1, counter._buckets.Last.GetAdder(HystrixRollingNumberEvent.TIMEOUT).Sum());
            }
            catch (Exception e)
            {
                output.WriteLine(e.ToString());
                Assert.True(false, "Exception: " + e.Message);
            }
        }
Beispiel #10
0
            public void Increments_The_Counter()
            {
                var rollingNumber = new HystrixRollingNumber(10000, 10);

                // Act
                rollingNumber.Increment(HystrixRollingNumberEvent.Success);

                long valueOfLatestBucket = rollingNumber.GetValueOfLatestBucket(HystrixRollingNumberEvent.Success);

                Assert.Equal(1L, valueOfLatestBucket);
            }
Beispiel #11
0
            public void Increments_The_Counter()
            {
                var dateTimeProvider = new Mock <IDateTimeProvider>();
                var rollingNumber    = new HystrixRollingNumber(dateTimeProvider.Object, 10000, 10);

                // Act
                rollingNumber.Increment(HystrixRollingNumberEvent.Success);

                long valueOfLatestBucket = rollingNumber.GetValueOfLatestBucket(HystrixRollingNumberEvent.Success);

                Assert.Equal(1L, valueOfLatestBucket);
            }
Beispiel #12
0
        public void TestShortCircuited()
        {
            MockedTime time = new MockedTime();

            try
            {
                HystrixRollingNumber counter = new HystrixRollingNumber(time, 200, 10);

                // Increment
                counter.Increment(HystrixRollingNumberEvent.SHORT_CIRCUITED);

                // we should have 1 bucket
                Assert.Equal(1, counter._buckets.Size);

                // the count should be 1
                Assert.Equal(1, counter._buckets.Last.GetAdder(HystrixRollingNumberEvent.SHORT_CIRCUITED).Sum());
                Assert.Equal(1, counter.GetRollingSum(HystrixRollingNumberEvent.SHORT_CIRCUITED));

                // sleep to get to a new bucket
                time.Increment(counter._bucketSizeInMillseconds * 3);

                // incremenet again in latest bucket
                counter.Increment(HystrixRollingNumberEvent.SHORT_CIRCUITED);

                // we should have 4 buckets
                Assert.Equal(4, counter._buckets.Size);

                // the counts of the last bucket
                Assert.Equal(1, counter._buckets.Last.GetAdder(HystrixRollingNumberEvent.SHORT_CIRCUITED).Sum());

                // the total counts
                Assert.Equal(2, counter.GetRollingSum(HystrixRollingNumberEvent.SHORT_CIRCUITED));
            }
            catch (Exception e)
            {
                output.WriteLine(e.ToString());
                Assert.True(false, "Exception: " + e.Message);
            }
        }
Beispiel #13
0
        private void TestCounterType(HystrixRollingNumberEvent type)
        {
            MockedTime time = new MockedTime();

            try
            {
                HystrixRollingNumber counter = new HystrixRollingNumber(time, 200, 10);

                // increment
                counter.Increment(type);

                // we should have 1 bucket
                Assert.AreEqual(1, counter.Buckets.Size);

                // the count should be 1
                Assert.AreEqual(1, counter.Buckets.GetLast().GetAdder(type).Sum());
                Assert.AreEqual(1, counter.GetRollingSum(type));

                // sleep to get to a new bucket
                time.Increment(counter.BucketSizeInMilliseconds * 3);

                // increment again in latest bucket
                counter.Increment(type);

                // we should have 4 buckets
                Assert.AreEqual(4, counter.Buckets.Size);

                // the counts of the last bucket
                Assert.AreEqual(1, counter.Buckets.GetLast().GetAdder(type).Sum());

                // the total counts
                Assert.AreEqual(2, counter.GetRollingSum(type));
            }
            catch (Exception e)
            {
                TestContext.WriteLine(e.ToString());
                Assert.Fail("Exception: " + e.Message);
            }
        }
Beispiel #14
0
        public void RollingNumber_CumulativeCounterAfterRollingAndReset2()
        {
            MockedTime time = new MockedTime();
            HystrixRollingNumberEvent type    = HystrixRollingNumberEvent.Success;
            HystrixRollingNumber      counter = new HystrixRollingNumber(time, 20, 2);

            Assert.AreEqual(0, counter.GetCumulativeSum(type));

            counter.Increment(type);
            counter.Increment(type);
            counter.Increment(type);

            // iterate over 20 buckets on a queue sized for 2
            for (int i = 0; i < 20; i++)
            {
                try
                {
                    time.Increment(counter.BucketSizeInMilliseconds);
                }
                catch (Exception)
                {
                    // ignore
                }

                if (i == 5 || i == 15)
                {
                    // simulate a reset occurring every once in a while
                    // so we ensure the absolute sum is handling it okay
                    counter.Reset();
                }
            }

            // no increments during the loop, just some before and after
            counter.Increment(type);
            counter.Increment(type);

            // cumulative count should be 5 regardless of buckets rolling
            Assert.AreEqual(5, counter.GetCumulativeSum(type));
        }
        private void TestCounterType(HystrixRollingNumberEvent type)
        {
            var time = new MockedTime();

            try
            {
                var counter = new HystrixRollingNumber(time, 200, 10);

                // Increment
                counter.Increment(type);

                // we should have 1 bucket
                Assert.Equal(1, counter._buckets.Size);

                // the count should be 1
                Assert.Equal(1, counter._buckets.Last.GetAdder(type).Sum());
                Assert.Equal(1, counter.GetRollingSum(type));

                // sleep to get to a new bucket
                time.Increment(counter._bucketSizeInMillseconds * 3);

                // Increment again in latest bucket
                counter.Increment(type);

                // we should have 4 buckets
                Assert.Equal(4, counter._buckets.Size);

                // the counts of the last bucket
                Assert.Equal(1, counter._buckets.Last.GetAdder(type).Sum());

                // the total counts
                Assert.Equal(2, counter.GetRollingSum(type));
            }
            catch (Exception e)
            {
                output.WriteLine(e.ToString());
                Assert.True(false, "Exception: " + e.Message);
            }
        }
Beispiel #16
0
        public void RollingNumber_CounterRetrievalRefreshesBuckets()
        {
            MockedTime time = new MockedTime();

            try
            {
                HystrixRollingNumber counter = new HystrixRollingNumber(time, 200, 10);

                // increment
                counter.Increment(HystrixRollingNumberEvent.Success);
                counter.Increment(HystrixRollingNumberEvent.Success);
                counter.Increment(HystrixRollingNumberEvent.Success);
                counter.Increment(HystrixRollingNumberEvent.Success);
                counter.Increment(HystrixRollingNumberEvent.Failure);
                counter.Increment(HystrixRollingNumberEvent.Failure);

                // sleep to get to a new bucket
                time.Increment(counter.BucketSizeInMilliseconds * 3);

                // we should have 1 bucket since nothing has triggered the update of buckets in the elapsed time
                Assert.AreEqual(1, counter.Buckets.Size);

                // the total counts
                Assert.AreEqual(4, counter.GetRollingSum(HystrixRollingNumberEvent.Success));
                Assert.AreEqual(2, counter.GetRollingSum(HystrixRollingNumberEvent.Failure));

                // we should have 4 buckets as the counter 'gets' should have triggered the buckets being created to fill in time
                Assert.AreEqual(4, counter.Buckets.Size);

                // wait until window passes
                time.Increment(counter.TimeInMilliseconds);

                // the total counts should all be 0 (and the buckets cleared by the get, not only increment)
                Assert.AreEqual(0, counter.GetRollingSum(HystrixRollingNumberEvent.Success));
                Assert.AreEqual(0, counter.GetRollingSum(HystrixRollingNumberEvent.Failure));

                // increment
                counter.Increment(HystrixRollingNumberEvent.Success);

                // the total counts should now include only the last bucket after a reset since the window passed
                Assert.AreEqual(1, counter.GetRollingSum(HystrixRollingNumberEvent.Success));
                Assert.AreEqual(0, counter.GetRollingSum(HystrixRollingNumberEvent.Failure));
            }
            catch (Exception e)
            {
                TestContext.WriteLine(e.ToString());
                Assert.Fail("Exception: " + e.Message);
            }
        }
Beispiel #17
0
            public void Clears_All_Buckets()
            {
                var rollingNumber = new HystrixRollingNumber(10000, 10);

                rollingNumber.Increment(HystrixRollingNumberEvent.Success);

                long rollingSumBeforeReset = rollingNumber.GetRollingSum(HystrixRollingNumberEvent.Success);

                Assert.Equal(1L, rollingSumBeforeReset);

                // Act
                rollingNumber.Reset();

                long rollingSumAfterReset = rollingNumber.GetRollingSum(HystrixRollingNumberEvent.Success);

                Assert.Equal(0L, rollingSumAfterReset);
            }
Beispiel #18
0
        public void RollingNumber_CumulativeCounterAfterRollingAndReset()
        {
            MockedTime time = new MockedTime();
            HystrixRollingNumberEvent type    = HystrixRollingNumberEvent.Success;
            HystrixRollingNumber      counter = new HystrixRollingNumber(time, 20, 2);

            Assert.AreEqual(0, counter.GetCumulativeSum(type));

            // iterate over 20 buckets on a queue sized for 2
            for (int i = 0; i < 20; i++)
            {
                // first bucket
                counter.Increment(type);
                try
                {
                    time.Increment(counter.BucketSizeInMilliseconds);
                }
                catch (Exception)
                {
                    // ignore
                }

                Assert.AreEqual(2, counter.GetValues(type).Length);

                counter.GetValueOfLatestBucket(type);

                if (i == 5 || i == 15)
                {
                    // simulate a reset occurring every once in a while
                    // so we ensure the absolute sum is handling it okay
                    counter.Reset();
                }
            }

            // cumulative count should be 20 (for the number of loops above) regardless of buckets rolling
            Assert.AreEqual(20, counter.GetCumulativeSum(type));
        }
Beispiel #19
0
        public void TestIncrementInMultipleBuckets()
        {
            MockedTime time = new MockedTime();

            try
            {
                HystrixRollingNumber counter = new HystrixRollingNumber(time, 200, 10);

                // Increment
                counter.Increment(HystrixRollingNumberEvent.SUCCESS);
                counter.Increment(HystrixRollingNumberEvent.SUCCESS);
                counter.Increment(HystrixRollingNumberEvent.SUCCESS);
                counter.Increment(HystrixRollingNumberEvent.SUCCESS);
                counter.Increment(HystrixRollingNumberEvent.FAILURE);
                counter.Increment(HystrixRollingNumberEvent.FAILURE);
                counter.Increment(HystrixRollingNumberEvent.TIMEOUT);
                counter.Increment(HystrixRollingNumberEvent.TIMEOUT);
                counter.Increment(HystrixRollingNumberEvent.SHORT_CIRCUITED);

                // sleep to get to a new bucket
                time.Increment(counter._bucketSizeInMillseconds * 3);

                // Increment
                counter.Increment(HystrixRollingNumberEvent.SUCCESS);
                counter.Increment(HystrixRollingNumberEvent.SUCCESS);
                counter.Increment(HystrixRollingNumberEvent.FAILURE);
                counter.Increment(HystrixRollingNumberEvent.FAILURE);
                counter.Increment(HystrixRollingNumberEvent.FAILURE);
                counter.Increment(HystrixRollingNumberEvent.TIMEOUT);
                counter.Increment(HystrixRollingNumberEvent.SHORT_CIRCUITED);

                // we should have 4 buckets
                Assert.Equal(4, counter._buckets.Size);

                // the counts of the last bucket
                Assert.Equal(2, counter._buckets.Last.GetAdder(HystrixRollingNumberEvent.SUCCESS).Sum());
                Assert.Equal(3, counter._buckets.Last.GetAdder(HystrixRollingNumberEvent.FAILURE).Sum());
                Assert.Equal(1, counter._buckets.Last.GetAdder(HystrixRollingNumberEvent.TIMEOUT).Sum());
                Assert.Equal(1, counter._buckets.Last.GetAdder(HystrixRollingNumberEvent.SHORT_CIRCUITED).Sum());

                // the total counts
                Assert.Equal(6, counter.GetRollingSum(HystrixRollingNumberEvent.SUCCESS));
                Assert.Equal(5, counter.GetRollingSum(HystrixRollingNumberEvent.FAILURE));
                Assert.Equal(3, counter.GetRollingSum(HystrixRollingNumberEvent.TIMEOUT));
                Assert.Equal(2, counter.GetRollingSum(HystrixRollingNumberEvent.SHORT_CIRCUITED));

                // wait until window passes
                time.Increment(counter._timeInMilliseconds);

                // Increment
                counter.Increment(HystrixRollingNumberEvent.SUCCESS);

                // the total counts should now include only the last bucket after a reset since the window passed
                Assert.Equal(1, counter.GetRollingSum(HystrixRollingNumberEvent.SUCCESS));
                Assert.Equal(0, counter.GetRollingSum(HystrixRollingNumberEvent.FAILURE));
                Assert.Equal(0, counter.GetRollingSum(HystrixRollingNumberEvent.TIMEOUT));
            }
            catch (Exception e)
            {
                output.WriteLine(e.ToString());
                Assert.True(false, "Exception: " + e.Message);
            }
        }
Beispiel #20
0
        public void RollingNumber_IncrementInMultipleBuckets()
        {
            MockedTime time = new MockedTime();

            try
            {
                HystrixRollingNumber counter = new HystrixRollingNumber(time, 200, 10);

                // increment
                counter.Increment(HystrixRollingNumberEvent.Success);
                counter.Increment(HystrixRollingNumberEvent.Success);
                counter.Increment(HystrixRollingNumberEvent.Success);
                counter.Increment(HystrixRollingNumberEvent.Success);
                counter.Increment(HystrixRollingNumberEvent.Failure);
                counter.Increment(HystrixRollingNumberEvent.Failure);
                counter.Increment(HystrixRollingNumberEvent.Timeout);
                counter.Increment(HystrixRollingNumberEvent.Timeout);
                counter.Increment(HystrixRollingNumberEvent.ShortCircuited);

                // sleep to get to a new bucket
                time.Increment(counter.BucketSizeInMilliseconds * 3);

                // increment
                counter.Increment(HystrixRollingNumberEvent.Success);
                counter.Increment(HystrixRollingNumberEvent.Success);
                counter.Increment(HystrixRollingNumberEvent.Failure);
                counter.Increment(HystrixRollingNumberEvent.Failure);
                counter.Increment(HystrixRollingNumberEvent.Failure);
                counter.Increment(HystrixRollingNumberEvent.Timeout);
                counter.Increment(HystrixRollingNumberEvent.ShortCircuited);

                // we should have 4 buckets
                Assert.AreEqual(4, counter.Buckets.Size);

                // the counts of the last bucket
                Assert.AreEqual(2, counter.Buckets.GetLast().GetAdder(HystrixRollingNumberEvent.Success).Sum());
                Assert.AreEqual(3, counter.Buckets.GetLast().GetAdder(HystrixRollingNumberEvent.Failure).Sum());
                Assert.AreEqual(1, counter.Buckets.GetLast().GetAdder(HystrixRollingNumberEvent.Timeout).Sum());
                Assert.AreEqual(1, counter.Buckets.GetLast().GetAdder(HystrixRollingNumberEvent.ShortCircuited).Sum());

                // the total counts
                Assert.AreEqual(6, counter.GetRollingSum(HystrixRollingNumberEvent.Success));
                Assert.AreEqual(5, counter.GetRollingSum(HystrixRollingNumberEvent.Failure));
                Assert.AreEqual(3, counter.GetRollingSum(HystrixRollingNumberEvent.Timeout));
                Assert.AreEqual(2, counter.GetRollingSum(HystrixRollingNumberEvent.ShortCircuited));

                // wait until window passes
                time.Increment(counter.TimeInMilliseconds);

                // increment
                counter.Increment(HystrixRollingNumberEvent.Success);

                // the total counts should now include only the last bucket after a reset since the window passed
                Assert.AreEqual(1, counter.GetRollingSum(HystrixRollingNumberEvent.Success));
                Assert.AreEqual(0, counter.GetRollingSum(HystrixRollingNumberEvent.Failure));
                Assert.AreEqual(0, counter.GetRollingSum(HystrixRollingNumberEvent.Timeout));
            }
            catch (Exception e)
            {
                TestContext.WriteLine(e.ToString());
                Assert.Fail("Exception: " + e.Message);
            }
        }