MOQ what happen if method setup intersect?
<p>What happen when two setup intersect or overlap if you prefer.</p>

<p>For example, in the below scenario the setup overlap because obviously <code>"aSpecificString"</code> is also considered as any string. </p>

<pre><code>Interface ISomeInterface
{
    int SomeMethod(string param);
}

[TestMethod]
public void SomeClass_ShouldBehaveProperly_GivenSomeScenario()
{
    var mock = new Mock&lt;ISomeInterface&gt;(MockBehavior.Strict);
    mock.Setup(m =&gt; m.SomeMethod("aSpecificString"))
        .Returns(100);
    mock.Setup(m =&gt; m.SomeMethod(It.IsAny&lt;string&gt;()))
        .Returns(0);

    /*the rest of the test*/
}
</code></pre>

<p>I wonder what happen when it intersect.</p>

<p>Does it throw an exception or does it fail to detect the overlap and use the first matching setup in the order they were added?</p>

<p>I think it's best to avoid overlapping setup. </p>