public void TryGetValueRecognizesNonExistingItem()
        {
            // --- Arrange
            var cache = new TimeConstrainedCache <int, string>();

            cache.SetValue(1, "one");
            cache.SetValue(2, "two");

            // --- Act
            string value;
            var    found = cache.TryGetValue(3, out value);

            // --- Assert
            found.ShouldBeFalse();
        }
        public void TryGetValueRecognizesWithExpiredItem()
        {
            // --- Arrange
            var cache = new TimeConstrainedCache <int, string>(TimeSpan.FromMilliseconds(100));

            cache.SetValue(1, "one");
            cache.SetValue(2, "two");
            Thread.Sleep(200);

            // --- Act
            string value;
            var    found = cache.TryGetValue(2, out value);

            // --- Assert
            found.ShouldBeFalse();
        }
        public void TryGetValueWorksAsExpected()
        {
            // --- Arrange
            var cache = new TimeConstrainedCache <int, string>();

            cache.SetValue(1, "one");
            cache.SetValue(2, "two");

            // --- Act
            string value;
            var    found = cache.TryGetValue(2, out value);

            // --- Assert
            found.ShouldBeTrue();
            value.ShouldEqual("two");
        }
        public void TryGetValueWorksAsExpected()
        {
            // --- Arrange
            var cache = new TimeConstrainedCache<int, string>();
            cache.SetValue(1, "one");
            cache.SetValue(2, "two");

            // --- Act
            string value;
            var found = cache.TryGetValue(2, out value);

            // --- Assert
            found.ShouldBeTrue();
            value.ShouldEqual("two");
        }
        public void TryGetValueRecognizesWithExpiredItem()
        {
            // --- Arrange
            var cache = new TimeConstrainedCache<int, string>(TimeSpan.FromMilliseconds(100));
            cache.SetValue(1, "one");
            cache.SetValue(2, "two");
            Thread.Sleep(200);

            // --- Act
            string value;
            var found = cache.TryGetValue(2, out value);

            // --- Assert
            found.ShouldBeFalse();
        }
        public void TryGetValueRecognizesNonExistingItem()
        {
            // --- Arrange
            var cache = new TimeConstrainedCache<int, string>();
            cache.SetValue(1, "one");
            cache.SetValue(2, "two");

            // --- Act
            string value;
            var found = cache.TryGetValue(3, out value);

            // --- Assert
            found.ShouldBeFalse();
        }