コード例 #1
0
        public void TestCacheDifferentInstanceOnceClearCache()
        {
            var target = MongoUrl.Create("mongodb://host1");
            var cache1 = getCacheReference(target);

            MongoUrl.ClearCache();

            var cache2 = getCacheReference(target);

            Assert.AreNotSame(cache1, cache2, "The 2 cache references shoudl refer to different object since CacheClear() exchanges the old ref to a new empty dictionary");
        }
コード例 #2
0
        public void TestCacheEmptyAfterClear()
        {
            var target = MongoUrl.Create("mongodb://host1");

            Dictionary <string, MongoUrl> cache = getCacheReference(target);

            Assert.AreEqual(1, cache.Count);
            MongoUrl.ClearCache();

            cache = getCacheReference(target);

            Assert.AreEqual(0, cache.Count);
        }