Example #1
0
        public void TestPollingCards()
        {
            PollingCards pollingCards = new PollingCards("test election", "01-01-01-2011", "09.00 - 20.00");
            Person       person       = new Person {
                FirstName    = "Hans",
                LastName     = "Sørensen",
                Street       = "Hovedgaden 10",
                City         = "2300 København S",
                PollingTable = "1",
            };

            Address pollingVenue = new Address {
                Name = "Byskolen", Street = "Lærervej 8", City = "2300 København S"
            };
            Address sender = new Address {
                Name = "Rådhuset", Street = "Ministervej 8", City = "2100 København Ø"
            };

            pollingCards.CreatePollingCard(person, sender, pollingVenue);

            Assert.False(File.Exists("testpollingcard.pdf"));
            pollingCards.SaveToDisk("testpollingcard.pdf");
            Assert.True(File.Exists("testpollingcard.pdf"));
            File.Delete("testpollingcard.pdf");
        }
Example #2
0
        /// <summary>
        /// Can you save the polling cards for this polling venue on the harddrive?
        /// </summary>
        /// <param name="pollingVenue">The polling venue</param>
        /// <param name="electionName">The name of the election</param>
        /// <param name="electionDate">The date of the election</param>
        public void SavePollingCards(PollingVenue pollingVenue, string electionName, string electionDate)
        {
            Contract.Requires(pollingVenue != null);
            Contract.Ensures(File.Exists(this.path + "\\PollingCards.pdf"));

            var pollingCards = new PollingCards(electionName, electionDate, "09.00 - 20.00");

            foreach (var person in pollingVenue.Persons)
            {
                pollingCards.CreatePollingCard(person, pollingVenue.MunicipalityAddress, pollingVenue.PollingVenueAddress);
            }

            pollingCards.SaveToDisk(this.path + "\\PollingCards.pdf");
        }