Example #1
0
        public void GetMissingValueTest()
        {
            string    projectId = this.projectId;
            string    token     = this.token;
            IronCache target    = new IronCache(projectId, token);

            string key   = "this is an arbitrary key";
            string cache = "test_cache";

            target.Remove(cache, key);
            var actual = target.Get <string>(cache, key);

            Assert.IsNull(actual);
        }
Example #2
0
        public void IncrementNonExistingTest()
        {
            string    projectId = this.projectId;
            string    token     = this.token;
            IronCache target    = new IronCache(projectId, token);

            string key   = "82de17a0-cab9-45a5-a851-bccb210a9e1f";
            string cache = "test_cache";

            target.Remove(cache, key);
            try
            {
                var actual = target.Increment(cache, key, 1);
                Assert.Fail();
            }
            catch (KeyNotFoundException)
            {
            }
        }
Example #3
0
        public void GetMissingValueTest()
        {
            string projectId = this.projectId;
            string token = this.token;
            IronCache target = new IronCache(projectId, token);

            string key = "this is an arbitrary key";
            string cache = "test_cache";

            target.Remove(cache, key);
            var actual = target.Get<string>(cache, key);
            Assert.IsNull(actual);
        }
Example #4
0
        public void IncrementNonExistingTest()
        {
            string projectId = this.projectId;
            string token = this.token;
            IronCache target = new IronCache(projectId, token);

            string key = "82de17a0-cab9-45a5-a851-bccb210a9e1f";
            string cache = "test_cache";
            target.Remove(cache, key);
            try
            {
                var actual = target.Increment(cache, key, 1);
                Assert.Fail();
            }
            catch (KeyNotFoundException)
            {
            }
        }
        public void IncrementExistingIntegerTest()
        {
            string projectId = _projectId;
            string token = _token;
            IronCache target = new IronCache(projectId, token);

            string key = "cf435dc2-7f12-4f37-94c2-26077b3cd414"; // random unique identifier
            string cache = "test_cache";
            target.Remove(cache, key);
            target.Put(cache, key, 0, false, false, 10);
            var expected = 1;
            var actual = target.Increment(cache, key, 1);
            Assert.AreEqual(expected, actual);
        }