My primary reason for using an interface is to make unit testing easy. But I feel like I am not understanding how to use interfaces 100%.
Here's a simplified version of what I'm trying to do:
public interface IPlan { List<Plan> GetPlans(IPlan plan); List<Plan> GetAllPlans(); List<string> DoSomethingElse(); } public class Plan : IPlan { List<Plan> GetPlans(IPlan plan) { // List<Plan> planList = plan.GetAllPlans(); // // Do stuff with planList... // } For setting up a unit test I need to be able to mock the Plan class and return a set list of plans from GetAllPlans, so I see I should be using the interface here so that I can mock it properly. I also understand (or at least I think) that I should be passing in an IPlan object to GetPlans and then I should be using that IPlan object to call GetAllPlans... but something doesn't seem right with this set up.
Am I setting this up incorrectly? It seems weird that I am passing an IPlan that is the same type as the class that it is in (I'd be passing in an IPlan that is a Plan). Any advice on this?