title: How to make a mock throw an exception the first time and return a value the second one
body: <p>I am using Moq as my mocking framework and I need to test a class that when a specific type of exception is run it will keep trying until the situation is resolved once that happens the execution finishes.</p>
  
  <p>So what I need is something similar to:</p>
  
  <pre><code>myMock = Mock&lt;IFoo&gt;();
  
  myMock.Setup(m =&gt; m.Excecute()).Throws&lt;SpecificException&gt;();
  myMock.Setup(m =&gt; m.Execute());
  
  var classUnderTest = MyClass(myMock);
  classUnderTest.DoSomething();
  
  Assert.AreEqual(expected, classUnderTest.Result);
  </code></pre>
  
  <p>Thanks for any help you can give.</p>