def test_Event_CreateAnEventWithListener_GetListernerReturnsSameValue(self): event = Event.with_listerners([Listener("listener1")]) self.assertEquals(event.get_listeners(), [Listener("listener1")])
def test_Event_WhenNotSubscribedCallIngUnsubscribe_RaisesAnException(self): event = Event.with_listerners([]) with self.assertRaises(NotSubscribedException): event.unsubscribe("listener1")
def test_Event_WhenAllreadySubscribedCallIngSubscribe_RaisesAnException(self): event = Event.with_listerners([Listener("listener1")]) with self.assertRaises(AllreadySubscribedException): event.subscribe("listener1")
def test_Event_CallIngUnsubscribe_RemovesAListener(self): event = Event.with_listerners([Listener("listener1")]) event.unsubscribe("listener1") self.assertEquals(event.get_listeners_methods(), [])
def test_Event_NewEventWithListernerArguement_HasListenersGiven(self): event = Event.with_listerners([Listener("listener1")]) listeners = event.get_listeners_methods() self.assertEquals(listeners, ["listener1"])