Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void successfulRetriesBreakTheRetryLoop()
        public virtual void SuccessfulRetriesBreakTheRetryLoop()
        {
            CountingSleeper countingSleeper       = new CountingSleeper();
            int             retries               = 5;
            MultiRetryStrategy <int, int> subject = new MultiRetryStrategy <int, int>(0, retries, NullLogProvider.Instance, countingSleeper);

            // when
            subject.Apply(3, System.Func.identity(), VALID_ON_SECOND_TIME);

            // then
            assertEquals(1, countingSleeper.InvocationCount());
        }
Exemple #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void numberOfIterationsDoesNotExceedMaximum()
        public virtual void NumberOfIterationsDoesNotExceedMaximum()
        {
            // given
            CountingSleeper countingSleeper       = new CountingSleeper();
            int             retries               = 5;
            MultiRetryStrategy <int, int> subject = new MultiRetryStrategy <int, int>(0, retries, NullLogProvider.Instance, countingSleeper);

            // when
            subject.Apply(3, System.Func.identity(), _neverValid);

            // then
            assertEquals(retries, countingSleeper.InvocationCount());
        }
Exemple #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void successOnRetryCausesNoDelay()
        public virtual void SuccessOnRetryCausesNoDelay()
        {
            // given
            CountingSleeper countingSleeper       = new CountingSleeper();
            int             retries               = 10;
            MultiRetryStrategy <int, int> subject = new MultiRetryStrategy <int, int>(0, retries, NullLogProvider.Instance, countingSleeper);

            // when
            int?result = subject.Apply(3, System.Func.identity(), _alwaysValid);

            // then
            assertEquals(0, countingSleeper.InvocationCount());
            assertEquals("Function identity should be used to retrieve the expected value", 3, result.Value);
        }