So I'm pretty new to testing and while it makes a lot of sense to me, some things just don't feel right.
For example: Is it acceptable to use quite a lot of mocks to test a method?
Specifically, I'm testing my Service Layer which has a method to book a date. There are a lot of plausibility checks so it looks a bit like this: (not actual code)
public bool BookDate(Person person, int dateId, MyRoom room...)
{
var date = this.dateRepo.Get(dateId)
if (date == null) return false
if (!this.personService.Get(person.id)) return false;
if (!this.personService.IsValidPerson(person)) return false;
... more validations
}
So the method has to do validations and those, in turn, are dependent on the data provided of course (if they are not interfaces themselves). Testing the different cases means mocking a lot.
Also, I often have to repeat mocking to pass the validations and to get to the actual thing I want to test (for example further down the method, passing a lot of if's)
How can I test this more easily? I could maybe split the method into sub methods but then again, to mock those I would have to expose them in my interface although they're not itself useful to other classes.