I am working on a new project, and I am using the repository template, I have my repository that retrieves data from the database and the “service” class, which uses the repository and runs all the business logic.
something similar to the following:
public class UserRepository : IUserRepository
{
public IQueryable<User> GetUsers()
{
}
}
public class UserService
{
public IList<User> GetUserById
{
var rep = new UserRepository();
var users = rep.GetUsers();
return users.ToList();
}
}
Do you check both UserService and UserRepository, or do you think testing will be enough for maintenance? I believe that since the service uses the repository, this should be fun, but it kills the code coverage.
source
share