Skip to content

Instantly share code, notes, and snippets.

@mgroves
Created December 17, 2010 17:50
Show Gist options
  • Save mgroves/745361 to your computer and use it in GitHub Desktop.
Save mgroves/745361 to your computer and use it in GitHub Desktop.
[TestFixture]
public class DynamicTest
{
[Test]
public void DynamicTestMethod()
{
dynamic result = GetRating();
Assert.AreEqual(result.Count, 10);
Assert.AreEqual(result.Sum, 50);
}
public dynamic GetRating()
{
return new { Count = 10, Sum = 50 };
}
}
@mgroves
Copy link
Author

mgroves commented Dec 17, 2010

On line 7, you can use "var" instead of "dynamic" too, if you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment