示例#1
0
 def test_Event_CreateAnEventWithListener_GetListernerReturnsSameValue(self):
     event = Event.with_listerners([Listener("listener1")])
     
     self.assertEquals(event.get_listeners(), [Listener("listener1")])
示例#2
0
 def test_Event_WhenNotSubscribedCallIngUnsubscribe_RaisesAnException(self):
     event = Event.with_listerners([])
     
     with self.assertRaises(NotSubscribedException):
         event.unsubscribe("listener1")
示例#3
0
 def test_Event_WhenAllreadySubscribedCallIngSubscribe_RaisesAnException(self):
     event = Event.with_listerners([Listener("listener1")])
     
     with self.assertRaises(AllreadySubscribedException):
         event.subscribe("listener1")
示例#4
0
 def test_Event_CallIngUnsubscribe_RemovesAListener(self):
     event = Event.with_listerners([Listener("listener1")])
     
     event.unsubscribe("listener1")
     
     self.assertEquals(event.get_listeners_methods(), [])
示例#5
0
 def test_Event_NewEventWithListernerArguement_HasListenersGiven(self):
     event = Event.with_listerners([Listener("listener1")])
     
     listeners = event.get_listeners_methods()
     
     self.assertEquals(listeners, ["listener1"])