Aspectacular.Test.RetryAspectsTest.SimulateFailureNTimes C# (CSharp) Method

SimulateFailureNTimes() private method

Will be failing a few times it's called.
private SimulateFailureNTimes ( uint timesToFail, bool throwExceptionOnFailure = true ) : object
timesToFail uint
throwExceptionOnFailure bool
return object
        private object SimulateFailureNTimes(uint timesToFail, bool throwExceptionOnFailure = true)
        {
            this.iteration++;

            if(this.iteration <= timesToFail)
            {
                if(throwExceptionOnFailure)
                    throw new Exception("Simulated count failure");

                return null;
            }

            return DateTime.UtcNow;
        }