public void DispatchEventWhenABindExists() { DomainEvent.Bind <TestEvent, FirstTestHandler>(serviceProviderMock.Object); DomainEvent.Dispatch(new TestEvent()); Assert.True(FirstTestHandler.WasCalled); }
internal void EnableAnswersOfTheCurrentQuestion(Guid userId) { if (UserIsTheFacilitator(userId)) { CurrentQuestion.EnableAnswers(); DomainEvent.Dispatch(new WhenTheQuestionIsEnabled(this)); } }
public void BindMoreThanOneHandlerToTheSameEvent() { DomainEvent.Bind <TestEvent, FirstTestHandler>(serviceProviderMock.Object); DomainEvent.Bind <TestEvent, SecondTestHandler>(serviceProviderMock.Object); DomainEvent.Dispatch(new TestEvent()); Assert.True(FirstTestHandler.WasCalled); Assert.True(SecondTestHandler.WasCalled); }
internal void AnswerTheCurrentQuestion(Guid userId, Answer answer, string annotation) { if (UserCanAnswerTheCurrentQuestion(userId)) { CurrentQuestion.ContabilizeTheAnswer(userId, answer, annotation); if (CurrentQuestion.AllUsersHasAnswered(Participants)) { CurrentQuestion.DisableAnswers(); ChangeTheCurrentQuestion(); DomainEvent.Dispatch(new WhenAllUsersAnswerTheQuestion(this)); } } }
public void NotDispatchEventWhenABindNotExists() { DomainEvent.Dispatch(new TestEvent()); Assert.False(ThirdTestHandler.WasCalled); }