Created
July 27, 2010 12:45
-
-
Save timwingfield/492171 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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