Skip to content

Instantly share code, notes, and snippets.

@blairconrad
Last active April 25, 2016 23:21
Show Gist options
  • Save blairconrad/1570c29c831cab9c598926b25c7f171e to your computer and use it in GitHub Desktop.
Save blairconrad/1570c29c831cab9c598926b25c7f171e to your computer and use it in GitHub Desktop.
public delegate bool TrySomething(string key, out string result);
[Test]
public void Should_be_able_to_assign_out_and_ref()
{
var fake = A.Fake<TrySomething>();
string sample = null;
string expectedOut = "hello";
string result = null;
A.CallTo(() => fake.Invoke("key", out sample)).WithAnyArguments().Returns(true).AssignsOutAndRefParameters(expectedOut);
fake.Invoke("key", out result);
Assert.That(result, Is.SameAs(expectedOut));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment