public void VerifyCategoryProperties() { Category category = new Category { ID = 1, Name = "Uncategorised", CreatedBy = 1, CreatedOn = DateTime.Now, ModifiedBy = 1, ModifiedOn = DateTime.Now }; Assert.IsNotNull(category); }
public Category GetCategoryByID(int id) { const string sqlQuery = "SELECT ID, Name, CreatedOn " + "FROM Category " + "WHERE ID = @id"; Category category = new Category(); using (var reader = DbUtil.ExecuteReader(sqlQuery, new SQLiteParameter("@id", id))) { if (reader.Read()) { category = ReadCategory(reader); } } return category; }