I have a class like so:
public class ClassA { public bool MethodA() { //do something complicated to test requiring a lot of setup } public bool MethodB() { if (MethodA()) //do something else //do something else endif } }
I have tests for MethodA and want to test MethodB, but all I want to do is to verify that if MethodA returns true that something happens and if MethodA returns false that something else happens. Can I do this with Rhino Mocks? Or do I have to set up all of the same mocks that I have already in the tests for MethodA?
You might have to extract an interface out of the class or make it abstract, I’m reasonbly sure that Rhino.Mocks can mock classes and interfaces. Which means you should be able to do something like this:
The syntax might be a little off but that should allow MethodB to be tested independently of MethodA