I'm working on a new project and I'm using the repository pattern, I have my repository that pulls the data from the database and a "service" class which uses the repository and does all the business logic.
something similar to the following;
public class UserRepository : IUserRepository
{
public IQueryable<User> GetUsers()
{
// do stuff
}
}
public class UserService
{
public IList<User> GetUserById
{
var rep = new UserRepository();
var users = rep.GetUsers();
// do business logic
return users.ToList();
}
}
Would you test both the UserService and the UserRepository or do you think testing just the Service would suffice? I figure since the service is using the repository it should be fun, but it does kill code coverage.