예제 #1
0
        public void Should_Contain_Initial_Values()
        {
            Assert.Equal(2, _singletonCache.GetCount());

            Assert.Equal("TestValue1", _singletonCache.GetOrNull("TestKey1"));
            Assert.Equal("TestValue2", _singletonCache.GetOrNull("TestKey2"));
        }
        public static object GetOrThrowException(this SingletonCache singletonCache, string key)
        {
            var value = singletonCache.GetOrNull(key);

            if (value == null)
            {
                throw new ApplicationException("Given key was not present in the cache: " + key);
            }

            return(value);
        }