コード例 #1
0
def test_weShouldKnowWhoIsAtTheParty():
    party = Party()
    lisa = Guest("Lisa", 'female')
    rob = Guest("Rob", 'male')
    susan = Guest("susan", 'female')
    party.attendedBy(lisa)
    party.attendedBy(rob)
    party.attendedBy(susan)
    assert ["Lisa", "Rob", "susan"] == party.getAttendees()
コード例 #2
0
def test_aPartywithThreeGuestsShouldHaveThreeGuests():
    party = Party()
    lisa = Guest("Lisa", 'female')
    rob = Guest("Rob", 'male')
    susan = Guest("susan", 'female')
    party.attendedBy(lisa)
    party.attendedBy(rob)
    party.attendedBy(susan)
    assert 3 == party.numberOfGuests()
コード例 #3
0
def test_createShoppingListBasedOnParty():
    shoppingList = ShoppingList()
    party = Party()
    lisa = Guest("Lisa", 'female')
    rob = Guest("Rob", 'male')
    susan = Guest("susan", 'female')
    party.attendedBy(lisa)
    party.attendedBy(rob)
    party.attendedBy(susan)
    shoppingList.baseOn(party)
    assert shoppingList.getItems() == ["wine for 4", "food for 4"]
コード例 #4
0
def test_aPartywithNoGuestsShouldHaveNoPartyGuests():
    party = Party()
    assert 0 == party.numberOfGuests()
コード例 #5
0
def test_aPartyShouldHaveALocation():
    party = Party()
    party.setLocation("my House")
    assert "my House" == party.getLocation()
コード例 #6
0
def test_aGuestShouldBeAbleToLeaveAParty():
    party = Party()
    lisa = Guest("Lisa", 'female')
    rob = Guest("Rob", 'male')
    susan = Guest("susan", 'female')
    party.attendedBy(lisa)
    party.attendedBy(rob)
    party.attendedBy(susan)
    party.leftBy(rob)
    assert 2 == party.numberOfGuests()
コード例 #7
0
def test_aPartywithOneGuestShouldHaveOnePartyGuest():
    party = Party()
    lisa = Guest("Lisa", 'female')
    party.attendedBy(lisa)
    assert 1 == party.numberOfGuests()