Implementation of IClock which allows manually-specified times and increments.
This implementation is thread-safe.
Inheritance: IClock
Exemplo n.º 1
0
 public void ToCallOptions_CallTimingExpirationTimeout()
 {
     var clock = new FakeClock();
     var timeout = TimeSpan.FromSeconds(1);
     CallSettings callSettings = CallSettings.FromCallTiming(CallTiming.FromExpiration(Expiration.FromTimeout(timeout)));
     var options = callSettings.ToCallOptions(null, clock);
     // Value should be exact, as we control time precisely.
     Assert.Equal(options.Deadline.Value, clock.GetCurrentDateTimeUtc() + timeout);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Constructs a fake scheduler which works with the given clock.
 /// </summary>
 /// <param name="clock">Fake clock to observe for timing purposes.</param>
 public FakeScheduler(FakeClock clock)
 {
     Clock = GaxPreconditions.CheckNotNull(clock, nameof(clock));
 }