Beispiel #1
0
        public void GetCachedValue_ReturnsNullIfNotFound()
        {
            ConfigCacheTestHelper sut = new ConfigCacheTestHelper();

            sut.CacheInsert("SomeKey", "SomeValue");
            sut.CacheInsert("SomeKey", "SomeNewValue");
            sut.CacheInsert("SomeKey2", "SomeNewValue2");
            sut.CacheInsert("SomeKey3", "SomeNewValue3");

            Assert.IsNull(sut.GetCachedValue("SomeUnknownKey"));
        }
Beispiel #2
0
        public void ClearCache_ClearsTheCache()
        {
            ConfigCacheTestHelper sut = new ConfigCacheTestHelper();

            sut.CacheInsert("SomeKey", "SomeValue");
            sut.CacheInsert("SomeKey", "SomeNewValue");
            sut.CacheInsert("SomeKey2", "SomeNewValue2");
            sut.CacheInsert("SomeKey3", "SomeNewValue3");

            sut.ClearCache();

            Assert.That(sut.GetCacheLength() == 0);
        }
Beispiel #3
0
        public void TryGetCachedValue_ReturnsFalseINotfFound()
        {
            ConfigCacheTestHelper sut = new ConfigCacheTestHelper();

            sut.CacheInsert("SomeKey", "SomeValue");
            sut.CacheInsert("SomeKey", "SomeNewValue");
            sut.CacheInsert("SomeKey2", "SomeNewValue2");
            sut.CacheInsert("SomeKey3", "SomeNewValue3");


            string value;

            Assert.IsFalse(sut.TryGetCachedValue("SomeUnkownKey", out value));
        }
Beispiel #4
0
        public void TryGetCachedValue_SetsValueToNullIfNotFound()
        {
            ConfigCacheTestHelper sut = new ConfigCacheTestHelper();

            sut.CacheInsert("SomeKey", "SomeValue");
            sut.CacheInsert("SomeKey", "SomeNewValue");
            sut.CacheInsert("SomeKey2", "SomeNewValue2");
            sut.CacheInsert("SomeKey3", "SomeNewValue3");

            string value;

            sut.TryGetCachedValue("SomeUnkownKey", out value);
            Assert.IsNull(value);
        }
Beispiel #5
0
        public void TryGetCachedValue_SetsValueIfFound()
        {
            ConfigCacheTestHelper sut = new ConfigCacheTestHelper();

            sut.CacheInsert("SomeKey", "SomeValue");
            sut.CacheInsert("SomeKey", "SomeNewValue");
            sut.CacheInsert("SomeKey2", "SomeNewValue2");
            sut.CacheInsert("SomeKey3", "SomeNewValue3");


            string value;

            sut.TryGetCachedValue("SomeKey", out value);
            Assert.IsTrue(value == "SomeNewValue");
        }