Esempio n. 1
0
        public void InsertDeleteTest()
        {
            var cache = new Cache {
                Id                = -1,
                Name              = "my special test cache",
                CreationDate      = new DateTime(2010, 10, 17),
                TerrainDifficulty = 1.9,
                CacheDifficulty   = 2.5,
                Size              = "Regular",
                OwnerId           = 223,
                Position          = new GeoPosition(47.451, 13.89),
                Description       = "this is a test unit test cache"
            };

            int id = target.Insert(cache);

            Assert.IsTrue(id > 0);

            Cache newState = target.GetById(id);

            Assert.AreEqual(cache.TerrainDifficulty, newState.TerrainDifficulty);
            Assert.AreEqual(cache.Name, newState.Name);
            Assert.AreEqual(cache.OwnerId, newState.OwnerId);

            bool success = target.Delete(cache.Id);

            Assert.IsTrue(success);
            Assert.IsNull(target.GetById(id));
        }
Esempio n. 2
0
        public Cache CreateNewPositionedCache(int ownerId, double latitude, double longitude)
        {
            var defaultCache = new Cache {
                Id                = -1,
                Name              = "<default cache>",
                CreationDate      = DateTime.Now,
                CacheDifficulty   = 1,
                TerrainDifficulty = 1,
                Size              = "Regular",
                OwnerId           = ownerId,
                Position          = new GeoPosition(latitude, longitude),
                Description       = "put a short description here"
            };

            // just for owner id and longitude/latitude
            ValidateCache(defaultCache);
            cacheDao.Insert(defaultCache);
            return(defaultCache);
        }