Ejemplo n.º 1
0
        public async Task Should_not_Start_AuthorityPoll_By_VotingFrequency_Value()
        {
            var tenant = new Tenant
            {
                Id       = "test",
                HostName = "test.decidehub.com",
                InActive = false,
                Lang     = "tr"
            };

            _tenantsDbContext.Tenants.Add(tenant);
            _tenantsDbContext.SaveChanges();
            var setting = new Setting
            {
                Key   = Settings.VotingFrequency.ToString(),
                Value = "24"
            };

            _context.Settings.Add(setting);
            var poll = new AuthorityPoll
            {
                Name         = "test",
                Active       = false,
                CreateTime   = DateTime.UtcNow.AddDays(-24),
                QuestionBody = "test dfs",
                TenantId     = "test",
                Deadline     = DateTime.UtcNow.AddDays(-23)
            };

            _context.Polls.Add(poll);
            _context.SaveChanges();

            await _pollJobService.AuthorityPollStart();

            var authorityPolls = _context.AuthorityPolls;

            Assert.Equal(1, authorityPolls.Count());
        }
 protected override async Task RunAsync()
 {
     await _pollJobService.AuthorityPollStart();
 }