private User ReadUser(SQLiteDataReader reader) { User user = new User { Name = reader.Fetch<string>("Name"), CreatedOn = reader.Fetch<DateTime>("CreatedOn") }; return user; }
public void VerifyUserProperties() { User user = new User { ID = 1, Name = "Homer Simpson", Password = "******", CreatedBy = 1, CreatedOn = DateTime.Now, ModifiedBy = 1, ModifiedOn = DateTime.Now }; Assert.IsNotNull(user); }
public User GetUserByID(int id) { const string sqlQuery = "SELECT Name, CreatedOn " + "FROM User " + "WHERE ID = @id"; User user = new User(); using (var reader = DbUtil.ExecuteReader(sqlQuery, new SQLiteParameter("@id", id))) { if (reader.Read()) { user = ReadUser(reader); } } user.ID = id; return user; }