public void WithThrottle_DiscardCallsOnTimeout()
        {
            Int32 maxNumberOfCalls = FakeSoapApi.c_maxNumTimesCall;
            Int32 actualNumOfCalls = maxNumberOfCalls * 2;

            var values = new List<Int32>();

            Assert.DoesNotThrow(() =>
            {
                using (var throttle = new Throttle(maxNumberOfCalls, s_defaultWaiting))
                {
                    throttle.DiscardCallsOnTimeout(true);

                    var api = new FakeSoapApi();
                    for (Int32 i = 0; i < actualNumOfCalls; i++)
                    {
                        try
                        {
                            throttle.Call(() => {
                                values.Add(api.DoSomething());
                            });
                        }
                        catch (Exception<FakeSoapApiExceptionArgs>)
                        {
                            throttle.Wait();
                        }
                    }
                }
            });

            Assert.True(values.Count < actualNumOfCalls);
        }
        public void WithThrottle()
        {
            Int32 maxNumberOfCalls = FakeSoapApi.c_maxNumTimesCall;
            Int32 actualNumOfCalls = maxNumberOfCalls * 2;

            Assert.DoesNotThrow(() =>
            {
                using (var throttle = new Throttle(maxNumberOfCalls, s_defaultWaiting))
                {
                    for (Int32 i = 0; i < actualNumOfCalls; i++)
                    {
                        try
                        {
                            throttle.Call(() => {
                                new FakeSoapApi().DoSomething();
                            });
                        }
                        catch (Exception<FakeSoapApiExceptionArgs>)
                        {
                            throttle.Wait();
                        }
                    }
                }
            });
        }