예제 #1
0
        public void TryKeepAlive_Should_Return_Correct_Lag_Value()
        {
            const int AccountId = 1;
            var clock = new FakeClock(SystemClock.Instance.Now);
            var service = CreateAccountService(clock);

            int sessionId;
            service.TryRegisterSession(AccountId, out sessionId);

            TimeSpan lag;
            service.TryKeepAlive(AccountId, out lag);
            clock.AdvanceSeconds(15);
            service.TryKeepAlive(AccountId, out lag);

            lag.Duration().Should().Be(TimeSpan.FromSeconds(15));
        }
예제 #2
0
 public void AdvanceSeconds()
 {
     FakeClock clock = new FakeClock(Instant.FromUnixTimeTicks(100L));
     clock.AdvanceSeconds(3);
     Assert.AreEqual(100 + 3 * NodaConstants.TicksPerSecond, clock.GetCurrentInstant().ToUnixTimeTicks());
 }