public List<Beacon> GetAllBeacons()
 {
     IronCache cache = new IronCache("509ec7be7e4b7117f2006795", "3zjqFh8J3d382xfzTOFJXNB91Vw");
     //var test=cache.Get<string>("Beacon", "AllBeacons");
     //var test2 = JsonConvert.DeserializeObject<Beacon>(test);
     return NHibernateHelper.Session.Query<Beacon>().ToList();
 }
Esempio n. 2
0
        public void IronCacheConstructorTest()
        {
            string    projectId = this.projectId;
            string    token     = this.token;
            IronCache target    = new IronCache(projectId, token);

            Assert.IsNotNull(target);
        }
Esempio n. 3
0
        public void CachesTest()
        {
            string        projectId = this.projectId;
            string        token     = this.token;
            IronCache     target    = new IronCache(projectId, token);
            var           expected  = 1;
            IList <Cache> actual;

            actual = target.Caches();
            Assert.IsNotNull(actual);
            Assert.AreEqual(expected, actual.Count);
        }
Esempio n. 4
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);
        }
Esempio n. 5
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);
        }
Esempio n. 6
0
        public void AddGetIntTest()
        {
            string projectId = this.projectId;
            string token = this.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);
        }
Esempio n. 7
0
        public void AddGetTest()
        {
            string projectId = _projectId;
            string token = _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);
        }
Esempio n. 8
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);
        }
Esempio n. 9
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)
            {
            }
        }
Esempio n. 10
0
 public void Setup()
 {
     var cre = Credentials.LoadFrom(@"..\..\..\..\..\unversioned\ironcache credentials.txt");
     _cache = new io.iron.ironcache.IronCache(cre.ProjectId, cre.Token);
 }
Esempio n. 11
0
        public void IronCacheConstructorTest()
        {
            string projectId = this.projectId;
            string token = this.token;
            IronCache target = new IronCache(projectId, token);

            Assert.IsNotNull(target);
        }
Esempio n. 12
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)
            {
            }
        }
Esempio n. 13
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);
        }
Esempio n. 14
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);
        }
Esempio n. 15
0
 public void CachesTest()
 {
     string projectId = this.projectId;
     string token = this.token;
     IronCache target = new IronCache(projectId, token);
     var expected = 1;
     IList<Cache> actual;
     actual = target.Caches();
     Assert.IsNotNull(actual);
     Assert.AreEqual(expected, actual.Count);
 }
Esempio n. 16
0
 public IronIOCache(string cacheName, IronIOCredentials ironIoCredentials)
 {
     _cacheName = cacheName;
     _cache = new IronCache(ironIoCredentials.ProjectId, ironIoCredentials.Token);
 }