Beispiel #1
0
        public void AdvanceSeconds()
        {
            FakeClock clock = new FakeClock(Instant.FromUnixTimeTicks(100L));

            clock.AdvanceSeconds(3);
            Assert.AreEqual(100 + 3 * NodaConstants.TicksPerSecond, clock.GetCurrentInstant().ToUnixTimeTicks());
        }
Beispiel #2
0
        public void AdvanceSeconds()
        {
            FakeClock clock = new FakeClock(new Instant(100L));

            clock.AdvanceSeconds(3);
            Assert.AreEqual(100 + 3 * NodaConstants.TicksPerSecond, clock.Now.Ticks);
        }
        public void GettingEntry_BeforeExpirationTime_ShouldReturnEntry()
        {
            var entry = new Entry(_dataProtector.Protect(Password), null, Duration.FromMinutes(1), _clock);

            _dbContext.Entries.Add(entry);
            _clock.AdvanceSeconds(59);
            var result = _sut.Get(entry.Id).ValueUnsafe().ValueUnsafe();

            result.Should().NotBeNull();
        }
Beispiel #4
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));
        }