Ejemplo n.º 1
0
        public void TestTruncateTwoPlaces2()
        {
            // Arrange
            SimpleCount1 sc             = new SimpleCount1(new Contest(2));
            double       expectedAnswer = 1.66;

            // Act
            double answer = sc.truncateTwoPlaces(10, 6);

            // Assert
            Assert.AreEqual(expectedAnswer, answer);
        }
Ejemplo n.º 2
0
        public void TestTruncateTwoPlaces3()
        {
            /*
             * TruncateTwoPlaces can take either an int or a double as the first argument
             */

            // Arrange
            SimpleCount1 sc             = new SimpleCount1(new Contest(2));
            double       expectedAnswer = 0.03;

            // Act
            double answer = sc.truncateTwoPlaces(0.1, 3);

            // Assert
            Assert.AreEqual(expectedAnswer, answer);
        }
Ejemplo n.º 3
0
        public void TestTruncateTwoPlaces1()
        {
            /*
             * TruncateTwoPlaces divides the first argument
             * by the second argument.
             * The answer goes to two decimal places but there is no rounding
             */

            // Arrange
            SimpleCount1 sc             = new SimpleCount1(new Contest(2));
            double       expectedAnswer = 3.33;

            // Act
            double answer = sc.truncateTwoPlaces(10, 3);

            // Assert
            Assert.AreEqual(expectedAnswer, answer);
        }
Ejemplo n.º 4
0
        public try1()
        {
            new Contest(2);
            Console.WriteLine("qq");

            ContestCurrent = ContestMaker.ExampleContest2();

            ContestCurrent.Seats = 2; // Int32.Parse(Txb_Seats.Text);

            // Lsb_Candidates.ItemsSource = ContestCurrent.Candidates;
            // Lsb_Candidates.Items.Refresh();

            // Lsb_Votes.ItemsSource = ContestCurrent.BallotPapers;
            // Lsb_Votes.Items.Refresh();

            // doSimpleCount();


            SimpleCount1 sc = new SimpleCount1(ContestCurrent);

            // string s = sc.getResults();

            Console.WriteLine(sc.getResults());
        }