Azavea.Open.Common.Tests.TimedCacheTests.TryGetTest1 C# (CSharp) Method

TryGetTest1() private method

private TryGetTest1 ( ) : void
return void
        public void TryGetTest1()
        {
            TimedCache<int, object> cache = new TimedCache<int, object>(new TimeSpan(0, 1, 0));

            object o = null;
            Assert.IsFalse(cache.TryGet(1, ref o));
            Assert.IsNull(o);

            cache.Set(1, o);
            Assert.IsTrue(cache.TryGet(1, ref o));
            Assert.IsNull(o);

            o = new object();
            cache.Set(1, o);
            Assert.IsTrue(cache.TryGet(1, ref o));
            Assert.IsNotNull(o);
        }