Tests.Generator.Next C# (CSharp) Method

Next() public method

public Next ( ) : bool
return bool
        public bool Next()
        {
            var result =  (_currentTimes = TriedTimes + 1) > _trueAfterTimes;
            if (!result && _throwsException)
            {
                if (RandomExceptionType && TriedTimes % 2 == 0)
                {
                    Console.WriteLine("Throwing InvalidOperationException");
                    throw new InvalidOperationException();
                }
                else
                {
                    Console.WriteLine("Throwing ApplicationException");
                    throw new ApplicationException();
                }
            }
            return result;
        }

Usage Example

コード例 #1
0
 public async Task TestOnTimeoutShouldNotFireAsync()
 {
     var times     = 5;
     var generator = new Generator(times);
     await _target.TryAsync(() => generator.Next())
     .OnTimeout(() => Assert.Fail())
     .Until(t => t);
 }
All Usage Examples Of Tests.Generator::Next