Overloaded return values in MOQ
问题 I'm working on understanding a bit more about Setup and unit testing with Moq. I've run into a slight problem though. What I want to do is something like this: view.Setup(x => x.GetReference("object1")).Returns(object1); view.Setup(x => x.GetReference("object2")).Returns(null); However, when I make my call this way, I never hit the block of code that would react to the Null statement. How am I supposed to set up my Setups so that they will behave in a specific way when they are called by a