Skip to content

Instantly share code, notes, and snippets.

@thecodejunkie
Forked from grumpydev/dynamictestcase.cs
Created January 25, 2011 21:21
Show Gist options
  • Save thecodejunkie/795702 to your computer and use it in GitHub Desktop.
Save thecodejunkie/795702 to your computer and use it in GitHub Desktop.
[Fact]
public void Should_be_able_to_impliclity_cast_dynamic_member_to_int()
{
// Given
this.dictionary.foo = 2;
// When
int value = this.GetIntValue(this.dictionary.foo);
// Then
value.ShouldEqual(2);
}
[Fact]
public void Should_be_able_to_impliclity_cast_index_member_to_int()
{
// Given
this.dictionary.foo = 2;
// When
int value = this.GetIntValue(this.dictionary["foo"]);
// Then
value.ShouldEqual(2);
}
private int GetIntValue(int value)
{
return value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment