public Cache GetCacheById(int cacheId) { ValidateCacheId(cacheId); try { return(cacheDao.GetById(cacheId)); } catch { throw new Exception("Error: Unable to connect to database."); } }
public void UpdateTest() { const int id = 112; Cache actual = target.GetById(id); String originalName = actual.Name; String expectedName = actual.Name + id; var creationDate = new DateTime(2008, 07, 19); actual.Name = expectedName; Assert.IsTrue(target.Update(actual)); actual = target.GetById(id); Assert.AreEqual(expectedName, actual.Name); Assert.AreEqual(creationDate, actual.CreationDate); actual.Name = originalName; Assert.IsTrue(target.Update(actual)); actual = target.GetById(id); Assert.AreEqual(originalName, actual.Name); }