示例#1
0
        public void PathsCanBeRetrieved()
        {
            var id   = _cache.AddOrGet(new[] { "test", "path" });
            var path = _cache.Get(id);

            string result = path.Select(t => _tags.Get(t)).Aggregate((t, i) => t + ", " + i);

            Assert.That(result, Is.EqualTo("test, path"));
        }
示例#2
0
        public void PathsCanBeRetrievedByKeyAfterOpen()
        {
            var tags = new[]
            {
                "alpha", "beta", "charlie", "delta", "echo", "foxtrot", "golf"
            };

            var id = 0;

            for (var ix = 0; ix < tags.Length; ix++)
            {
                id = _cache.AddOrGet(tags.Take(ix + 1));
            }

            var opened = new PathsCache(_tags);

            _cache.Dispose();

            _cache = opened;
            opened.Open(_path);

            var path = _cache.Get(id);

            Assert.That(path, Is.EqualTo(new [] { 2, 3, 4, 5, 6, 7, 8 }));
        }