예제 #1
0
        public void AddGetTest()
        {
            string    projectId = this.projectId;
            string    token     = this.token;
            IronCache target    = new IronCache(projectId, token);

            string value = "this is some arbitrary text";
            string key   = "this is an arbitrary key";
            string cache = "test_cache";

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

            Assert.IsNotNull(actual);
            Assert.AreEqual(value, actual);
        }
예제 #2
0
        public void AddGetIntTest()
        {
            string projectId = _projectId;
            string token = _token;
            IronCache target = new IronCache(projectId, token);

            int value = 10;
            string key = "this is an arbitrary key";
            string cache = "test_cache";

            target.Put(cache, key, value);
            var actual = target.Get<int?>(cache, key);

            Assert.IsNotNull(actual);
            Assert.AreEqual(value, actual);
        }
예제 #3
0
        public void IncrementExistingIntegerTest()
        {
            string    projectId = this.projectId;
            string    token     = this.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);
            var expected = 1;

            target.Put(cache, key, 0, false, false, 0);
            var actual = target.Increment(cache, key, 1);

            Assert.AreEqual(expected, actual);
        }
예제 #4
0
        public void AddGetTest()
        {
            string projectId = this.projectId;
            string token = this.token;
            IronCache target = new IronCache(projectId, token);

            string value = "this is some arbitrary text";
            string key = "this is an arbitrary key";
            string cache = "test_cache";

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

            Assert.IsNotNull(actual);
            Assert.AreEqual(value, actual);
        }
예제 #5
0
        public void IncrementExistingIntegerTest()
        {
            string projectId = this.projectId;
            string token = this.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);
            var expected = 1;
            target.Put(cache, key, 0, false, false, 0);
            var actual = target.Increment(cache, key, 1);
            Assert.AreEqual(expected, actual);
        }