title: readable substitution of IEnumerable of Interfaces
body: <p>I have the following interfaces</p>
  
  <pre><code>public interface IRibbonCommandsProvider
  {
      IEnumerable&lt;IRibbonCommand&gt; GetRibbonCommands();
  }
  public interface IRibbonCommand
  {
      string Group { get; }
      string Tab { get; }
      string Name { get; }
      string Image { get; }
      void Execute();
  }
  </code></pre>
  
  <p>And the follwing substitution code:</p>
  
  <pre><code>public class TabsViewModelTests
  {
      [Fact]
      public void Initialize_BuildsCorrectRibbonTree()
      {
          var commands = Substitute.For&lt;IRibbonCommandsProvider&gt;();
          commands.GetRibbonCommands().Returns(
              new[]
              {
                  new RibbonCommand { Tab = "Tab1", Group = "Group1", Name = "Name1" },
                  new RibbonCommand { Tab = "Tab1", Group = "Group1", Name = "Name2" },
                  new RibbonCommand { Tab = "Tab2", Group = "Group1", Name = "Name3" },
                  new RibbonCommand { Tab = "Tab2", Group = "Group2", Name = "Name3" }
              });
             ...
      }
  
      private class RibbonCommand : IRibbonCommand
      {
          public string Group { get; set; }
          public string Tab { get; set; }
          public string Name { get; set; }
          public string Image { get; set; }
          public void Execute() {}
      }
  }
  </code></pre>
  
  <p>Using NSubstitute, is there a clever way to get rid of the stub RibbonCommand class (that is nothing but a fake <code>IRibbonCommand</code> implementation - and that's NSubstitute's job) <em>and still have list of fake ribbon commands that is as <strong>easily readable</strong> as the above</em>?.</p>
  
  <p>I can't come up with a readable way using NSubsitute's <code>.Returns()</code> fluent method without ending with a lot more (and unreadable) code.</p>
  
  <p><strong>Update:</strong>
  A cool NSubstitute extension method could look like this. I just don't know if and how this can be built:</p>
  
  <pre><code>public static ConfiguredCall ReturnsMany&lt;T&gt;(
      this IEnumerable&lt;T&gt; value,
      Action&lt;T&gt; configureThis,
      params Action&lt;T&gt;[] configureThese)
  {
      ...
  }
  </code></pre>
  
  <p>It would be used like this:</p>
  
  <pre><code>commands.GetRibbonCommands().ReturnsMany(
      subst =&gt;
      {
          subst.Tab.Returns("Tab1");
          subst.Group.Returns("Group1");
          subst.Name.Returns("Name1");
      },
      subst =&gt;
      {
          subst.Tab.Returns("Tab1");
          subst.Group.Returns("Group1");
          subst.Name.Returns("Name2");
      },
      subst =&gt;
      {
          subst.Tab.Returns("Tab2");
          subst.Group.Returns("Group1");
          subst.Name.Returns("Name3");
      },
      subst =&gt;
      {
          subst.Tab.Returns("Tab2");
          subst.Group.Returns("Group1");
          subst.Name.Returns("Name3");
      });
  </code></pre>