title: Mocking multiple instances of interface: Setup of the last mock affects the others
body: <p>Following my question about <a href="https://stackoverflow.com/q/57758285/6844481">conditional-dependency-resolver-on-run-time</a></p>
  
  <p>I built a <code>BooService</code> that has a injected array of <code>IFooService[]</code>, And a <code>FooFactory</code> method that return one of the foo services based on a given key on run time.</p>
  
  <pre><code>class BooService
  {
      readonly IFooService[] _fooServices;
  
      BooService(IFooService[] services)
      {
          this._fooServices = services;
      }
      IFooService FooFactory(Guid id)
      {
          IFooService fooService = Array.Find(this._fooServices, 
                                       service =&gt; service.Id == id);
          return fooService;
      }
  }
  
  public class FooService1 : IFooService
  {
      public int Id { get { return 1; }  
  }
  public class FooService2 : IFooService
  {
      public int Id { get { return 2; }  
  }
  </code></pre>
  
  <p>Everything works OK on run-time but my UnitTests fails:</p>
  
  <pre><code>AutoMock _mock = Autofac.Extras.Moq.AutoMock.GetLoose();
  Mock&lt;IFooService&gt; fooService1 = _mock.Mock&lt;IFooService&gt;();
  fooService1
      .Setup(x =&gt; x.Id)
      .Returns(1);
  
  Mock&lt;IFooService&gt; fooService2 = _mock.Mock&lt;IFooService&gt;();
  fooService2
      .Setup(x =&gt; x.Id)
      .Returns(2);
  
  IFooService[] fooServices = new IFooService[] { fooService1.Object, fooService2.Object };
  
  BooService booService = new BooService(fooServices);
  booService.FooFactory(1); //Result in null
  booService.FooFactory(2); //Result in "fooService2"
  </code></pre>
  
  <p>For the id of 1 the line code of <code>Array.Find(this._fooServices, ...);</code> result in <code>null</code>! </p>
  
  <p>When I comment the creation of the second instance of the mocked interface the code of <code>booService.FooFactory(1);</code> result in <code>fooService1</code>. 
  So I guessing the second <code>Setup</code> affects somehow on the first instance.</p>
  
  <p>Any suggestion why when creating two mocked instance of the interface makes the <code>Array.Find(...)</code> <strong>find only last created mocked instance</strong>?</p>
  
  <p>If it is a bug in <code>Moq</code>: any clean work around to unit test the find process?</p>