public void ExecuteEvictionLogsAMessageOnceAndReturnsIfStrategyIsDisabled() { // given var configuration = new BeaconCacheConfiguration(0L, 1000L, 2000L); var target = new TimeEvictionStrategy(mockLogger, mockBeaconCache, configuration, mockTimingProvider, isShutdownFunc); mockLogger.IsInfoEnabled.Returns(true); // when executing the first time target.Execute(); // then var tmp = mockLogger.Received(1).IsInfoEnabled; mockLogger.ReceivedWithAnyArgs(1).Info(string.Empty); mockBeaconCache.DidNotReceiveWithAnyArgs().EvictRecordsByAge(0, 0L); // and when executing a second time mockLogger.ClearReceivedCalls(); target.Execute(); // then tmp = mockLogger.DidNotReceive().IsInfoEnabled; mockLogger.DidNotReceiveWithAnyArgs().Info(string.Empty); mockBeaconCache.DidNotReceiveWithAnyArgs().EvictRecordsByAge(0, 0L); }
public void ExecuteEvictionLogsAMessageOnceAndReturnsIfStrategyIsDisabled() { // given var configuration = MockBeaconCacheConfig(0L, 1000L, 2000L); var target = CreateTimeEvictionStrategyWith(configuration); var key = new BeaconKey(0, 0); mockLogger.IsInfoEnabled.Returns(true); // when executing the first time target.Execute(); // then _ = mockLogger.Received(1).IsInfoEnabled; mockLogger.ReceivedWithAnyArgs(1).Info(string.Empty); mockBeaconCache.DidNotReceiveWithAnyArgs().EvictRecordsByAge(key, 0L); // and when executing a second time mockLogger.ClearReceivedCalls(); target.Execute(); // then _ = mockLogger.DidNotReceive().IsInfoEnabled; mockLogger.DidNotReceiveWithAnyArgs().Info(string.Empty); mockBeaconCache.DidNotReceiveWithAnyArgs().EvictRecordsByAge(key, 0L); }