Example #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, PollContext context)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseCors("MyPolicy");
            app.UseAuthentication();
            app.UseMvc();

            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Member API v1");
            });


            DBInitializer.Initialize(context);
        }
Example #2
0
        public async Task <PollPayload> CreatePoll(
            PollInput poll,
            [Service] IPollService pollService,
            [Service] IPollRepository pollRepository,
            [Service] IUserRepository userRepository,
            [Service] PollContext pollContext,
            [Service] IHttpContextAccessor httpContextAccessor)
        {
            Result <Model.Poll> createdPoll = await pollService.CreatePoll(pollContext, pollRepository, userRepository, new NewPollDto
            {
                AuthorId       = httpContextAccessor.UserId(),
                GuestNicknames = poll.Guests.ToArray(),
                Proposals      = poll.Proposals.ToArray(),
                Question       = poll.Question
            });

            return(createdPoll.ToGraphQL(
                       () => new PollPayload(),
                       (p, e) => p.Errors = e,
                       p => new Poll
            {
                PollId = p.PollId,
                Question = p.Question
            },
                       (payload, poll) => payload.Poll = poll));
        }
 protected void RaisePolledEvent(IQEventManager eventManager, PolledEventHandler handler, HsmEventHolder holder, PollContext pollContext)
 {
     if (handler != null)
     {
         handler (eventManager, holder.Hsm, holder.Event, pollContext);
     }
 }
        public async Task guest_add_answer_to_proposal()
        {
            using (PollContext pollContext = TestHelpers.CreatePollContext())
            {
                PollContextAccessor pollContextAccessor = new PollContextAccessor(pollContext);
                var pollRepository = new PollRepository(pollContextAccessor);
                var userRepository = new UserRepository(pollContextAccessor);


                string email    = $"test-{Guid.NewGuid()}@test.fr";
                string nickname = $"Test-{Guid.NewGuid()}";

                Result <User> user = await TestHelpers.UserService.CreateUser(userRepository, email, nickname, "validpassword");

                Result <User> guest = await TestHelpers.UserService.CreateUser(userRepository, $"{email}-guest", $"{nickname}-guest", "validpassword");

                var pollDto = new NewPollDto
                {
                    AuthorId       = user.Value.UserId,
                    Question       = "Test-Question ",
                    GuestNicknames = new[] { guest.Value.Nickname },
                    Proposals      = new[] { "proposal1", "proposal2" },
                };
                var pollCreated = await TestHelpers.PollService.CreatePoll(pollContext, pollRepository, userRepository, pollDto);

                var addAnswer = await TestHelpers.PollService.Answer(pollContext, pollRepository, pollCreated.Value.PollId, guest.Value.UserId, pollCreated.Value.Proposals[0].ProposalId);

                addAnswer.IsSuccess.Should().BeTrue();
                await TestHelpers.PollService.DeletePoll(pollContext, pollRepository, pollCreated.Value.PollId);

                await TestHelpers.UserService.DeleteUser(pollContext, userRepository, pollRepository, user.Value.UserId);

                await TestHelpers.UserService.DeleteUser(pollContext, userRepository, pollRepository, guest.Value.UserId);
            }
        }
        void ProcessNext(IAsyncResult result)
        {
            PollContext context = (PollContext)result.AsyncState;

            if (!context.PollAborted)
            {
                try
                {
                    context.Processor(result, context);
                }
                catch (Exception e)
                {
                    this.pollContext = null;
                    context.Close();
                    if (!context.PollAborted)
                    {
                        this.FaultAllSubscriptions(e);
                    }
                }
            }
            else
            {
                this.pollContext = null;
                context.Close();
            }
        }
Example #6
0
        public async Task deleted_user_cannot_create_poll()         // Nicolas
        {
            using (PollContext pollContext = TestHelpers.CreatePollContext())
            {
                PollContextAccessor pollContextAccessor = new PollContextAccessor(pollContext);
                UserRepository      userRepository      = new UserRepository(pollContextAccessor);
                PollRepository      pollRepository      = new PollRepository(pollContextAccessor);

                Result <User> user = await TestHelpers.UserService.CreateUser(userRepository, $"test-{Guid.NewGuid()}@test.fr", $"Test-{Guid.NewGuid()}", "validpassword");

                Result <User> userGuest = await TestHelpers.UserService.CreateUser(userRepository, $"test-{Guid.NewGuid()}@test.fr", $"Test-{Guid.NewGuid()}", "validpassword");

                Result res = await TestHelpers.UserService.DeleteUser(pollContext, userRepository, pollRepository, user.Value.UserId);

                res.IsSuccess.Should().BeTrue();

                Result <Poll> pollRes = await TestHelpers.PollService.CreatePoll(pollContext, pollRepository, userRepository, new NewPollDto()
                {
                    AuthorId       = user.Value.UserId,
                    Question       = "A question",
                    Proposals      = new string[] { "Proposal A", "Proposal B" },
                    GuestNicknames = new string[] { userGuest.Value.Nickname }
                });

                pollRes.Error.Should().Be(Errors.AccountDeleted);
            }
        }
        void StartPoll()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat(CultureInfo.InvariantCulture, "{0}subscriptions/volatile?", this.baseAddress);
            int i = 0;

            foreach (Subscription s in this.subscriptions.Values)
            {
                if (i > 0)
                {
                    sb.Append("&");
                }
                sb.AppendFormat(CultureInfo.InvariantCulture, "subs[{0}][topicid]={1}", i, s.TopicId);
                if (s.From > 0)
                {
                    sb.AppendFormat(CultureInfo.InvariantCulture, "&subs[{0}][from]={1}", i, s.From);
                }
                i++;
            }
            this.pollContext = new PollContext
            {
                Poll      = (HttpWebRequest)WebRequest.Create(sb.ToString()),
                Processor = this.ProcessPollResponse
            };
#if SILVERLIGHT
            this.pollContext.Poll.AllowReadStreamBuffering = false;
#else
            this.pollContext.Poll.Pipelined           = false;
            this.pollContext.Poll.ConnectionGroupName = this.connectionGroupName;
#endif
            this.pollContext.Poll.BeginGetResponse(this.processNext, this.pollContext);
        }
Example #8
0
        public async Task create_poll()
        {
            using (PollContext pollContext = TestHelpers.CreatePollContext())
            {
                PollContextAccessor pollContextAccessor = new PollContextAccessor(pollContext);
                PollRepository      sut = new PollRepository(pollContextAccessor);

                // We should create user for create poll associated with this user
                UserRepository userRepository = new UserRepository(pollContextAccessor);
                string         email          = $"{Guid.NewGuid()}@test.org";
                string         nickname       = $"Test-{Guid.NewGuid()}";
                User           user           = new User(0, email, nickname, "hash", false);
                Result         userCreated    = await userRepository.Create(user);

                Model.Poll poll = new Model.Poll(0, user.UserId, "Question?", false);

                Result creationStatus = await sut.Create(poll);

                userCreated.IsSuccess.Should().BeTrue();
                creationStatus.IsSuccess.Should().BeTrue();
                Result <Model.Poll> foundPoll = await sut.FindById(poll.PollId);

                foundPoll.IsSuccess.Should().BeTrue();
                foundPoll.Value.AuthorId.Should().Be(poll.AuthorId);
                foundPoll.Value.PollId.Should().Be(poll.PollId);
                foundPoll.Value.Question.Should().Be(poll.Question);
                foundPoll.Value.IsDeleted.Should().BeFalse();

                await TestHelpers.PollService.DeletePoll(pollContext, sut, poll.PollId);

                await TestHelpers.UserService.DeleteUser(pollContext, userRepository, sut, user.UserId);
            }
        }
 protected void DoPolledEvent(IQEventManager eventManager, IQHsm hsm, IQEvent ev, PollContext pollContext)
 {
     if (OnPolledEvent (eventManager, hsm, ev, pollContext))
     {
         RaisePolledEvent (eventManager, PolledEvent, hsm, ev, pollContext);
     }
 }
 protected void DoPolledEvent(IQEventManager eventManager, HsmEventHolder holder, PollContext pollContext)
 {
     if (OnPolledEvent (eventManager, holder, pollContext))
     {
         RaisePolledEvent (eventManager, PolledEvent, holder, pollContext);
     }
 }
Example #11
0
        public async Task create_poll()
        {
            using (PollContext pollContext = TestHelpers.CreatePollContext())
            {
                var pollContextAccessor = new PollContextAccessor(pollContext);
                var userRepository      = new UserRepository(pollContextAccessor);
                var sut         = new PollRepository(pollContextAccessor);
                var userService = TestHelpers.UserService;

                // create the user that'll later be the poll author
                var email    = $"{Guid.NewGuid()}@test.org";
                var nickname = $"Test-{Guid.NewGuid()}";
                await userService.CreateUser(
                    userRepository,
                    email,
                    nickname,
                    "test-hash"
                    );

                var author = await userService.FindByNickname(userRepository, nickname);

                // create the guests that'll be used to create the poll
                var guest1 = await TestHelpers.UserService.CreateUser(
                    userRepository,
                    $"{Guid.NewGuid()}@test.org",
                    $"Test-{Guid.NewGuid()}",
                    "test-hash"
                    );

                var guest2 = await TestHelpers.UserService.CreateUser(
                    userRepository,
                    $"{Guid.NewGuid()}@test.org",
                    $"Test-{Guid.NewGuid()}",
                    "test-hash"
                    );

                var poll = new Model.Poll(0, author.Value.UserId, "question?", false);
                poll.AddGuest(guest1.Value.UserId, await sut.GetNoProposal());
                poll.AddGuest(guest2.Value.UserId, await sut.GetNoProposal());
                poll.AddProposal("P1");
                poll.AddProposal("P2");

                var result = await sut.Create(poll);

                result.IsSuccess.Should().BeTrue();
                poll.PollId.Should().NotBe(0);

                var createdPoll = await sut.FindById(poll.PollId);

                createdPoll.Value.PollId.Should().Be(poll.PollId);

                await TestHelpers.UserService.DeleteUser(pollContext, userRepository, sut, author.Value.UserId);

                await TestHelpers.UserService.DeleteUser(pollContext, userRepository, sut, guest1.Value.UserId);

                await TestHelpers.UserService.DeleteUser(pollContext, userRepository, sut, guest2.Value.UserId);
            }
        }
Example #12
0
        public PollControllerTests()
        {
            var optionsBuilder = new DbContextOptionsBuilder <PollContext>();

            optionsBuilder.UseInMemoryDatabase("WhenTest");

            _pollsContext          = new PollContext(optionsBuilder.Options);
            _pollsControllerToTest = new PollsController(_pollsContext);
        }
 void ProcessPollResponse(IAsyncResult result, PollContext context)
 {
     context.Response       = (HttpWebResponse)context.Poll.EndGetResponse(result);
     context.ResponseStream = context.Response.GetResponseStream();
     this.offset            = 0;
     this.count             = 0;
     context.Processor      = this.ProcessPollRead;
     context.ParsingContext = new MultipartMimeParsingContex();
     context.ResponseStream.BeginRead(this.buffer, this.offset, this.buffer.Length, this.processNext, context);
 }
Example #14
0
 public LoginController(PollContext pollContext
                        , SignInManager <User> signInManager
                        , UserManager <User> userManager
                        , IAuthService auth
                        , IConfigurationService appConfig)
 {
     Auth          = auth;
     AppConfig     = appConfig;
     SignInManager = signInManager;
     UserManager   = userManager;
     PollContext   = pollContext;
 }
Example #15
0
        public async Task <VotePayload> Vote(
            VoteInput vote,
            [Service] IPollService pollService,
            [Service] IPollRepository pollRepository,
            [Service] PollContext pollContext,
            [Service] IHttpContextAccessor httpContextAccessor)
        {
            int    userId = httpContextAccessor.UserId();
            Result result = await pollService.Answer(pollContext, pollRepository, vote.PollId, userId, vote.ProposalId);

            return(result.ToGraphQL(() => new VotePayload(), (p, e) => p.Errors = e));
        }
Example #16
0
        public Statistics Get(int id)
        {
            QuizResult qResult = null;

            using (var db = new PollContext())
            {
                qResult = db.QuizResultSet.Single(r => r.Id == id);
            }

            var statistics = JsonConvert.DeserializeObject <Statistics>(qResult.Result);

            return(statistics);
        }
Example #17
0
        public async Task can_create_account_with_weird_valid_email(string email)         // Nicolas
        {
            using (PollContext pollContext = TestHelpers.CreatePollContext())
            {
                PollContextAccessor pollContextAccessor = new PollContextAccessor(pollContext);
                UserRepository      userRepository      = new UserRepository(pollContextAccessor);
                string nickname = $"Test-{Guid.NewGuid()}";
                pollContext.Database.BeginTransaction();
                Result <User> user = await TestHelpers.UserService.CreateUser(userRepository, email, nickname, "validpassword");

                pollContext.Database.RollbackTransaction();
                user.IsSuccess.Should().BeTrue();
            }
        }
Example #18
0
        public async Task create_poll_with_invalid_authorId_should_return_an_error()
        {
            using (PollContext pollContext = TestHelpers.CreatePollContext())
            {
                var pollContextAccessor = new PollContextAccessor(pollContext);
                var userRepository      = new UserRepository(pollContextAccessor);
                var sut         = new PollRepository(pollContextAccessor);
                var userService = TestHelpers.UserService;

                var poll   = new Model.Poll(0, -424, "question?", false);
                var result = await sut.Create(poll);

                result.IsSuccess.Should().BeFalse();
            }
        }
 void AbortPoll()
 {
     if (this.pollContext != null)
     {
         lock (this.syncRoot)
         {
             if (this.pollContext != null)
             {
                 this.pollContext.PollAborted = true;
                 this.pollContext.Poll.Abort();
                 this.pollContext = null;
             }
         }
     }
 }
Example #20
0
        public AdminController(PollContext pollContext
                               , UserManager <User> userManager
                               , RoleManager <IdentityRole <long> > roleManager
                               , SignInManager <User> signInManager
                               , IHttpContextAccessor contextAccessor
                               , IAuthService auth
                               , IConfigurationService appConfig)
        {
            Auth          = auth;
            AppConfig     = appConfig;
            UserManager   = userManager;
            RoleManager   = roleManager;
            SignInManager = signInManager;

            PollContext = pollContext;
        }
Example #21
0
        public async Task heavy_load_test()         // Nicolas
        {
            using (PollContext pollContext = TestHelpers.CreatePollContext())
            {
                PollContextAccessor pollContextAccessor = new PollContextAccessor(pollContext);
                UserRepository      userRepository      = new UserRepository(pollContextAccessor);

                int load = 2_000;                 // I started with 1M then 20k but it was too slow...
                Task <Result <User> >[] tasks = new Task <Result <User> > [load];
                for (int i = 0; i < load; i++)
                {
                    tasks[i] = TestHelpers.UserService.CreateUser(userRepository, $"test-{Guid.NewGuid()}@test.fr", $"Test-{Guid.NewGuid()}", "validpassword");
                }
                await Task.WhenAll(tasks);

                tasks.Select(s => s.Result.IsSuccess).Should().NotContain(false);
            }
        }
Example #22
0
        public async Task create_poll()
        {
            using (PollContext pollContext = TestHelpers.CreatePollContext())
            {
                PollContextAccessor pollContextAccessor = new PollContextAccessor(pollContext);
                var pollRepository = new PollRepository(pollContextAccessor);
                var userRepository = new UserRepository(pollContextAccessor);


                string email    = $"test-{Guid.NewGuid()}@test.fr";
                string nickname = $"Test-{Guid.NewGuid()}";

                Result <User> user = await TestHelpers.UserService.CreateUser(userRepository, email, nickname, "validpassword");

                Result <User> guest = await TestHelpers.UserService.CreateUser(userRepository, $"{email}-guest", $"{nickname}-guest", "validpassword");

                var pollDto = new NewPollDto
                {
                    AuthorId       = user.Value.UserId,
                    Question       = "Test-Question ",
                    GuestNicknames = new[] { guest.Value.Nickname },
                    Proposals      = new[] { "proposal1", "proposal2" }
                };
                var pollCreated = await TestHelpers.PollService.CreatePoll(pollContext, pollRepository, userRepository, pollDto);

                pollCreated.IsSuccess.Should().BeTrue();
                pollCreated.Value.Guests.Should().HaveCount(pollDto.GuestNicknames.Length);
                pollCreated.Value.Proposals.Should().HaveCount(pollDto.Proposals.Length);
                pollCreated.Value.AuthorId.Should().Be(pollDto.AuthorId);
                pollCreated.Value.Question.Should().Be(pollDto.Question);

                var poll = await TestHelpers.PollService.FindById(pollRepository, pollCreated.Value.PollId);

                poll.IsSuccess.Should().BeTrue();

                await TestHelpers.PollService.DeletePoll(pollContext, pollRepository, pollCreated.Value.PollId);

                await TestHelpers.UserService.DeleteUser(pollContext, userRepository, pollRepository, user.Value.UserId);

                await TestHelpers.UserService.DeleteUser(pollContext, userRepository, pollRepository, guest.Value.UserId);
            }
        }
        void ProcessPollRead(IAsyncResult result, PollContext context)
        {
            int read = context.ResponseStream.EndRead(result);

            this.ParseMultipartMime(read, context.ParsingContext);
            if (read > 0)
            {
                this.EnsureRoomInBuffer();
                context.ResponseStream.BeginRead(this.buffer, this.offset + this.count, this.buffer.Length - this.offset - this.count, this.processNext, context);
            }
            else
            {
                context.Close();
                this.pollContext = null;
                if (this.subscriptions.Count > 0)
                {
                    this.StartPoll();
                }
            }
        }
        public async Task create_user()
        {
            using (PollContext pollContext = TestHelpers.CreatePollContext())
            {
                PollContextAccessor pollContextAccessor = new PollContextAccessor(pollContext);
                UserRepository      sut = new UserRepository(pollContextAccessor);
                string        email     = $"{Guid.NewGuid()}@test.org";
                string        nickname  = $"Test-{Guid.NewGuid()}";
                Result <User> user      = User.Create(email, nickname, "test-hash");

                Result creationStatus = await sut.Create(user.Value);

                creationStatus.IsSuccess.Should().BeTrue();
                Result <User> foundUser = await sut.FindByEmail(email);

                foundUser.IsSuccess.Should().BeTrue();
                foundUser.Value.Should().BeEquivalentTo(user.Value);

                PollRepository pollRepository = new PollRepository(pollContextAccessor);
                await TestHelpers.UserService.DeleteUser(pollContext, sut, pollRepository, foundUser.Value.UserId);
            }
        }
Example #25
0
        public async Task create_poll()
        {
            using (PollContext pollContext = TestHelpers.CreatePollContext())
            {
                PollContextAccessor pollContextAccessor = new PollContextAccessor(pollContext);
                PollRepository      pollRepository      = new PollRepository(pollContextAccessor);
                UserRepository      userRepository      = new UserRepository(pollContextAccessor);

                // We should create Author user for create poll associated with this user
                string        emailAuthor       = $"{Guid.NewGuid()}@test.org";
                string        nicknameAuthor    = $"Test-{Guid.NewGuid()}";
                Result <User> userAuthorCreated = await TestHelpers.UserService.CreateUser(userRepository, emailAuthor, nicknameAuthor, "hashpassword");

                // We should create Guest user for create poll associated with this user
                string        emailGuest       = $"{Guid.NewGuid()}@test.org";
                string        nicknameGuest    = $"Test-{Guid.NewGuid()}";
                Result <User> userGuestCreated = await TestHelpers.UserService.CreateUser(userRepository, emailGuest, nicknameGuest, "hashpassword");

                NewPollDto newPollDto = new NewPollDto();
                newPollDto.AuthorId       = userAuthorCreated.Value.UserId;
                newPollDto.Question       = "Question?";
                newPollDto.GuestNicknames = new string[] { userGuestCreated.Value.Nickname };
                newPollDto.Proposals      = new string[] { "P1", "P2" };

                Result <Poll> poll = await TestHelpers.PollService.CreatePoll(pollContext, pollRepository, userRepository, newPollDto);


                poll.IsSuccess.Should().BeTrue();
                Result <Poll> foundPoll = await TestHelpers.PollService.FindById(pollRepository, poll.Value.PollId);

                poll.Should().BeEquivalentTo(foundPoll);

                await TestHelpers.PollService.DeletePoll(pollContext, pollRepository, poll.Value.PollId);

                await TestHelpers.UserService.DeleteUser(pollContext, userRepository, pollRepository, userAuthorCreated.Value.UserId);

                await TestHelpers.UserService.DeleteUser(pollContext, userRepository, pollRepository, userGuestCreated.Value.UserId);
            }
        }
Example #26
0
 public AuthService(UserManager <User> userManager, IHttpContextAccessor contextAccessor, PollContext pollContext)
 {
     _pollContext     = pollContext;
     _userManager     = userManager;
     _contextAccessor = contextAccessor;
 }
Example #27
0
        public IActionResult Post([FromBody] Quiz value)
        {
            var statstic = new Statistics()
            {
                QuestionsCount = value.Questions.Count,
                Items          = new List <StatisticItem>()
            };

            Quiz originalQuiz = null;

            //получить из базы вопрос с ответами
            using (var db = new PollContext())
            {
                originalQuiz = db.QuizSet.Include("Questions").Include("Questions.AnswerOptions").Single(q => q.Id == value.Id);
            }

            //сверить ответы пользователя с реальными, и записать ответы
            foreach (var question in value.Questions)
            {
                var originalQuest = originalQuiz.Questions.Single(q => q.Id == question.Id);

                if (originalQuest.QuestionType == 1)
                {
                    statstic.Items.Add(new StatisticItem()
                    {
                        QuestionId     = originalQuest.Id,
                        CorrectAnswer  = question.UserAnswer == originalQuest.AnswerOptions.Single(o => o.Correct).Id,
                        AnswersOptions = new List <int>()
                        {
                            question.UserAnswer
                        }
                    });
                }


                if (originalQuest.QuestionType == 2)
                {
                    var userAnswers    = question.AnswerOptions.Where(o => o.Checked).Select(o => o.Id);
                    var correctAnswers = originalQuest.AnswerOptions.Where(o => o.Correct).Select(o => o.Id);

                    statstic.Items.Add(new StatisticItem()
                    {
                        QuestionId     = originalQuest.Id,
                        CorrectAnswer  = userAnswers.Count() == correctAnswers.Count() && userAnswers.Intersect(correctAnswers).Count() == userAnswers.Count(),
                        AnswersOptions = userAnswers.ToList()
                    });
                }

                if (originalQuest.QuestionType == 3)
                {
                    statstic.Items.Add(new StatisticItem()
                    {
                        QuestionId    = originalQuest.Id,
                        CorrectAnswer = question.UserTextAnswer.ToUpper() == originalQuest.TextAnswer.ToUpper(),
                        TextAnswer    = question.UserTextAnswer
                    });
                }
            }

            //посчитать количество верных ответов
            statstic.CorrectAnswersCount = statstic.Items.Count(i => i.CorrectAnswer);

            var jsonString = JsonConvert.SerializeObject(statstic);

            QuizResult quizResult = null;

            //сохранить результат для статистики, в json формате
            using (var db = new PollContext())
            {
                quizResult = new QuizResult()
                {
                    Quiz   = db.QuizSet.Single(q => q.Id == value.Id),
                    Date   = DateTime.Now,
                    Result = jsonString
                };

                db.QuizResultSet.Add(quizResult);
                db.SaveChanges();
            }


            return(Ok(quizResult.Id));
        }
Example #28
0
 public GebruikerService(IOptions <AppSettings> appSettings, PollContext pollContext)
 {
     _appSettings = appSettings.Value;
     _pollContext = pollContext;
 }
 protected void RaisePolledEvent(IQEventManager eventManager, PolledEventHandler handler, IQHsm hsm, IQEvent ev, PollContext pollContext)
 {
     if (handler != null)
     {
         handler (eventManager, hsm, ev, pollContext);
     }
 }
 public FriendshipController(PollContext context)
 {
     _context = context;
 }
 private void _EventManager_PolledEvent(IQEventManager eventManager, IQHsm hsm, IQEvent ev, PollContext pollContext)
 {
     DoPolledEvent (eventManager, hsm, ev, pollContext);
 }
 protected virtual bool OnPolledEvent(IQEventManager eventManager, IQHsm hsm, IQEvent ev, PollContext pollContext)
 {
     return true;
 }
 protected virtual bool OnPolledEvent(IQEventManager eventManager, HsmEventHolder holder, PollContext pollContext)
 {
     return true;
 }