Exemple #1
0
        public void TheStrategyIsDisabledIfBeaconMaxAgeIsSetToLessThanZero()
        {
            // given
            var configuration = MockBeaconCacheConfig(-1L, 1000L, 2000L);
            var target        = CreateTimeEvictionStrategyWith(configuration);

            // then
            Assert.That(target.IsStrategyDisabled, Is.True);
            Assert.That(mockLogger.ReceivedCalls(), Is.Empty);
            Assert.That(mockBeaconCache.ReceivedCalls(), Is.Empty);
            Assert.That(mockTimingProvider.ReceivedCalls(), Is.Empty);
        }
        public void CurrentTimeStampGet()
        {
            // given
            const long expected = 12356789;

            mockTimingProvider.ProvideTimestampInMilliseconds().Returns(expected);

            var target = CreateSendingContext().Build();

            Assert.That(mockTimingProvider.ReceivedCalls(), Is.Empty);

            // when
            var obtained = target.CurrentTimestamp;

            // then
            Assert.That(obtained, Is.EqualTo(expected));
            mockTimingProvider.Received(1).ProvideTimestampInMilliseconds();
        }
Exemple #3
0
        public void ConstructorTakesOverTimingProvider()
        {
            // given, when
            CreateSessionCreator();

            // then
            _ = mockInput.Received(1).TimingProvider;
            Assert.That(mockTimingProvider.ReceivedCalls(), Is.Empty);
        }