title: How to mock 'out' parameter?
body: <p>I have downloaded the latest NSubstitute release, 1.1.0, May 21, 2011. Prior to this release, it seems that NSub did not support out parameters. It appears that some work has been done to provide support through an intermediate release: <a href="http://groups.google.com/group/nsubstitute/browse_thread/thread/ab3139c9a5a6a38b" rel="nofollow">NSub Google Group</a>.</p>
  
  <p>So, I am having a little trouble trying to get all the pieces working. I am using <a href="http://systemwrapper.codeplex.com/wikipage?title=FileInfo%20Tutorial&amp;referringTitle=Home" rel="nofollow">SystemWrapper</a> to mock DirectoryInfo</p>
  
  <p>Here is my interface:</p>
  
  <pre><code>    public interface INetworkPath
      {
          void SetPath(string NetworkPath);
          bool TryGetDirectoryInfo(out IDirectoryInfoWrap DirectoryInfo);
      }
  </code></pre>
  
  <p>...and the test:</p>
  
  <pre><code>public void SetNetworkPath_SetDirectoryInfo()
  {
      var netPath = Substitute.For&lt;INetworkPath&gt;();
      netPath.SetPath("SomeNetworkPath");
      IDirectoryInfoWrap DirectoryInfo;
  
      netPath.TryGetDirectoryInfo(out DirectoryInfo)
             .Returns(d =&gt; {   // cannot convert lambda expression to type bool because it is not a delegate type
                 d[1] = Substitute.For&lt;IDirectoryInfoWrap&gt;();  //  d[1] is read only
                 return true;
             });
  
      Assert.IsNotNull(DirectoryInfo);
  }
  </code></pre>
  
  <p>Is there a way to mock the out parameter from the INetworkPath interface?</p>
  
  <p><strong>Update</strong>  </p>
  
  <p>Tried the following: although it compiles, <code>DirectoryInfo</code> returns null:</p>
  
  <pre><code>[Test]
  public void SetNetworkPath_SetDirectoryInfo()
  {
      var netPath = Substitute.For&lt;INetworkPath&gt;();
      netPath.SetPath("SomeNetworkPath");
      IDirectoryInfoWrap DirectoryInfo;
  
      netPath.TryGetDirectoryInfo(out DirectoryInfo)
             .Returns(d =&gt; { 
                 d = (CallInfo)Substitute.For&lt;IDirectoryInfoWrap&gt;();
                 return true;
             });
  
      Assert.IsNotNull(DirectoryInfo);
  }
  </code></pre>