예제 #1
0
        public void SimpeHydrate_Election()
        {
            var election           = Create();
            var electionRepository = new ElectionRepository(ContextConnection());
            var id = electionRepository.Save(election);

            Assert.IsNotNull(id);
            Assert.AreEqual(id, election.Id);
        }
예제 #2
0
        public void SimpeDeHydrateAll_Election()
        {
            var electionRepository = new ElectionRepository(ContextConnection());
            var election           = Create();

            electionRepository.Save(election);
            var owner = electionRepository.GetAll();

            Assert.That(owner.Any());
        }
예제 #3
0
        public override void Setup()
        {
            base.Setup();
            CategoryService     categoryService     = new CategoryService();
            PartyService        partyService        = new PartyService();
            TicketService       ticketService       = new TicketService();
            CategoryTypeService categoryTypeService = new CategoryTypeService();

            electionRepository = new ElectionRepository(null, new ElectionService(categoryService, categoryTypeService, partyService, ticketService));
        }
        public FormationTool()
        {
            InitializeComponent();
            _connector     = new SQLServerConnector();
            _partyRepo     = new PartyRepository(_connector);
            _electionRepo  = new ElectionRepository(_connector);
            _coalitionRepo = new CoalitionRepository(_connector);
            _resultsRepo   = new ResultsRepository(_connector);

            TK2017    = new Election("Tweede Kamerverkiezingen 2017", 150);
            results   = new Results("Resultaten " + TK2017.Name, TK2017);
            coalition = new Coalition("", "");

            _partyRepo.Refresh();
            results.ParticipatingParties = _partyRepo.Items;

            UpdateCListbox();
        }
        public ElectionModule(
            DiscordClient client,
            Scheduler scheduler,
            GaussConfig config,
            ElectionRepository repository
            )
        {
            this._client     = client;
            this._config     = config;
            this._scheduler  = scheduler;
            this._repository = repository;

            // Setup the UpdateElections function to run in the general scheduler:
            this._scheduler.AddTask(
                new TaskThunk(
                    this.ShouldUpdateElections,
                    this.UpdateElections
                    )
                );
        }
예제 #6
0
        public void Simple_Status_Election()
        {
            var electionRepository = new ElectionRepository(ContextConnection());
            var election           = Create();

            electionRepository.Save(election);
            electionRepository.SetInactive(election);
            var inactive = electionRepository.GetById(election.Id);

            Assert.That(inactive.Status == EntityStatus.Inactive);

            electionRepository.SetActive(election);
            var active = electionRepository.GetById(election.Id);

            Assert.That(active.Status == EntityStatus.Active);

            electionRepository.SetAsDeleted(election);
            var deleted = electionRepository.GetById(election.Id);

            Assert.That(deleted.Status == EntityStatus.Deleted);
        }
 public ElectionCommands(ElectionRepository pollRepository)
 {
     _pollRepository = pollRepository;
 }
예제 #8
0
        public static IElectionCollectionRepository GetElectionCollectionRepository()
        {
            IElectionCollectionRepository electionCollectionRepository = new ElectionRepository(new ElectionSqlContext());

            return(electionCollectionRepository);
        }
예제 #9
0
        internal static IElectionRepository GetElectionRepository()
        {
            IElectionRepository electionRepository = new ElectionRepository(new ElectionSqlContext());

            return(electionRepository);
        }