Skip to content

Instantly share code, notes, and snippets.

@timwingfield
Created July 27, 2010 12:45
Show Gist options
  • Save timwingfield/492171 to your computer and use it in GitHub Desktop.
Save timwingfield/492171 to your computer and use it in GitHub Desktop.
describe PersonTest, "when testing an isolation" do
before :each do
@isolation = Isolation.for IPerson
@pt = PersonTest.new(@isolation)
@pt.set_person_age_to_twenty
end
it "should have the age set to 20" do
@pt.person.age.should be(20)
end
end
**** C# code ****
public interface IPerson
{
int age { get; set; }
string name { get; set; }
}
public class Person : IPerson
{
public int age { get; set; }
public string name { get; set; }
}
public class PersonTest
{
IPerson _person;
public IPerson Person
{ get { return _person; } }
public PersonTest() : this(null) { }
public PersonTest(IPerson person)
{
_person = person ?? new Person();
}
public void SetPersonAgeToTwenty()
{
_person.age = 20;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment