Ejemplo n.º 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"));
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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");
        }