Exemplo n.º 1
0
        public void DoesNotFindExpiredKeys()
        {
            cache.Contains("key1").Should().BeFalse();
            cache.Contains("key2").Should().BeFalse();

            cache.Add("key1", 100);

            cache.Contains("key1").Should().BeTrue();
            cache.Contains("key2").Should().BeFalse();

            Thread.Sleep(200);

            cache.Contains("key1").Should().BeFalse();
            cache.Contains("key2").Should().BeFalse();
        }
        public void DeterminesWhenAStoreWasRecentlyPersisted()
        {
            _cacheWithExpiration.Contains("11111-0").Returns(true);

            _calculator.WasPersistedRecently("11111-0").Should().BeTrue();
            _calculator.WasPersistedRecently("22222-0").Should().BeFalse();
        }
 public bool WasPersistedRecently(StoreNumber storeNumber) => _cacheWithExpiration.Contains(storeNumber.ToString());