public AnswerTheCurrentQuestionShould() { Mock <IServiceProvider> serviceProviderMock = new Mock <IServiceProvider>(); serviceProviderMock.Setup(s => s.GetService(typeof(FakeHandler))).Returns(new FakeHandler()); DomainEvent.Bind <WhenAllUsersAnswerTheQuestion, FakeHandler>(serviceProviderMock.Object); }
public void DispatchEventWhenABindExists() { DomainEvent.Bind <TestEvent, FirstTestHandler>(serviceProviderMock.Object); DomainEvent.Dispatch(new TestEvent()); Assert.True(FirstTestHandler.WasCalled); }
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); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { DomainEvent.Bind <WhenTheQuestionIsEnabled, RefreshMeeting>(app.ApplicationServices); DomainEvent.Bind <WhenAllUsersAnswerTheQuestion, RefreshMeeting>(app.ApplicationServices); app.UseCors("CorsPolicy"); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); endpoints.MapHub <MeetingHub>("/meetingHub/{meetingId}"); }); }