implement testing and create a simple test for Userlist

This commit is contained in:
Carlos Martinez
2020-02-06 14:34:42 -03:00
parent 40e57a27ac
commit b720fb39e6
15 changed files with 199 additions and 25 deletions

View File

@@ -15,9 +15,6 @@ interface AlbumDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
fun saveAll(entities: List<AlbumEntity>)
@get:Query("SELECT * FROM ${AlbumEntity.TABLE_NAME}")
val all: List<AlbumEntity>
@Query("SELECT * FROM ${AlbumEntity.TABLE_NAME} WHERE userId = :userId ORDER BY id ASC")
fun getAlbums(userId: Int): List<AlbumEntity>

View File

@@ -15,9 +15,6 @@ interface PhotoDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
fun saveAll(entities: List<PhotoEntity>)
@get:Query("SELECT * FROM ${PhotoEntity.TABLE_NAME}")
val all: List<PhotoEntity>
@Query("SELECT * FROM ${PhotoEntity.TABLE_NAME} WHERE albumId = :albumId ORDER BY id ASC")
fun getPhotos(albumId: Int): List<PhotoEntity>

View File

@@ -18,9 +18,6 @@ interface UserDao {
@Query("UPDATE ${UserEntity.TABLE_NAME} SET isFavorite = :favorite WHERE id = :id")
fun saveFavorite(id: Int, favorite: Boolean): Int
@get:Query("SELECT * FROM ${UserEntity.TABLE_NAME}")
val all: List<UserEntity>
@Query("SELECT * FROM ${UserEntity.TABLE_NAME} ORDER BY id ASC")
fun getAllUsers(): List<UserEntity>

View File

@@ -13,7 +13,7 @@ data class UserEntity(
val email: String,
val phone: String,
val website: String,
val isFavorite: Boolean = true
val isFavorite: Boolean = false
) {
companion object {
const val TABLE_NAME = "users"