Exemplo n.º 1
0
            public void Request(long n)
            {
                var stack       = new StackTrace();
                var stackFrames = stack.GetFrames();

                if (stackFrames != null && stackFrames.Any(f => f.GetMethod().Name.Equals(_method)))
                {
                    _environment.Flop($"Subscription.Request MUST NOT be called from Subscriber.{_method} (Rule 2.3)!" +
                                      $"Caller: {stack}");
                }
            }
Exemplo n.º 2
0
        public Option <T> NextOrEndOfStream(long timeoutMilliseconds, string errorMessage)
        {
            Option <T> value;

            if (!_blockingCollection.TryTake(out value, TimeSpan.FromMilliseconds(timeoutMilliseconds)))
            {
                _environment.Flop($"{errorMessage} within {timeoutMilliseconds} ms");
                return(Option <T> .None);
            }

            return(value);
        }
Exemplo n.º 3
0
 public void ExpectCompletion(long timeoutMilliseconds, string errorMessage)
 {
     if (!IsCompleted())
     {
         T value;
         if (!_blockingCollection.TryTake(out value, TimeSpan.FromMilliseconds(timeoutMilliseconds)))
         {
             _environment.Flop($"{errorMessage} within {timeoutMilliseconds} ms");
         }
         else
         {
             _value = value;
         }
     }
 }
Exemplo n.º 4
0
 public void Request(long n)
 => _environment.Flop($"Subscriber {_subscriber} illegally called `Subscription.Request({n})`!");