Example #1
0
class MessageReceiverTests(TestCase):
    def setUp(self):
        self.receiver = MessageReceiver()
        self.sender = MessageReceiver()

    def test_tell(self):
        m = Message('buy more eggs', self.sender)
        self.receiver.tell(m)
        self.assertEqual(self.receiver.inbox, [m])

    def test_messages_in_order_received(self):
        m1 = Message('buy more eggs', self.sender)
        m2 = Message('buy a magazine', self.sender)

        self.receiver.tell(m1)
        self.receiver.tell(m2)

        self.assertEqual(self.receiver.inbox[m1, m2])
Example #2
0
class MessageReceiverTests(TestCase):
    def setUp(self):
        self.receiver = MessageReceiver()
        self.sender = MessageReceiver()

    def test_tell(self):
        m = Message('buy more eggs', self.sender)
        self.receiver.tell(m)
        self.assertEqual(self.receiver.inbox, [m])

    def test_messages_in_order_received(self):
        m1 = Message('buy more eggs', self.sender)
        m2 = Message('buy a magazine', self.sender)

        self.receiver.tell(m1)
        self.receiver.tell(m2)

        self.assertEqual(self.receiver.inbox [m1, m2])
Example #3
0
 def setUp(self):
     self.receiver = MessageReceiver()
     self.sender = MessageReceiver()
Example #4
0
 def setUp(self):
     self.receiver = MessageReceiver()
     self.sender = MessageReceiver()