public AnswerTheCurrentQuestionShould()
        {
            Mock <IServiceProvider> serviceProviderMock = new Mock <IServiceProvider>();

            serviceProviderMock.Setup(s => s.GetService(typeof(FakeHandler))).Returns(new FakeHandler());

            DomainEvent.Bind <WhenAllUsersAnswerTheQuestion, FakeHandler>(serviceProviderMock.Object);
        }
示例#2
0
        public void DispatchEventWhenABindExists()
        {
            DomainEvent.Bind <TestEvent, FirstTestHandler>(serviceProviderMock.Object);

            DomainEvent.Dispatch(new TestEvent());

            Assert.True(FirstTestHandler.WasCalled);
        }
示例#3
0
        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);
        }
示例#4
0
        // 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}");
            });
        }