コード例 #1
0
        public ActionResult DisplayResult()
        {
            PingPong      newPingPong = new PingPong();
            List <string> allNumbers  = newPingPong.GetResult(int.Parse(Request.Form["inputNumber"]));

            return(View(allNumbers));
        }
コード例 #2
0
        public void GetResult_NumberNotAMultipleOfAbove_2()
        {
            PingPong testPingPong = new PingPong();

            List <string> result = testPingPong.GetResult(2);

            Assert.AreEqual("2", result[1]);
        }
コード例 #3
0
        public void GetResult_NumberMultipleOfThree_ping()
        {
            PingPong testPingPong = new PingPong();

            List <string> result = testPingPong.GetResult(3);

            Assert.AreEqual("ping", result[2]);
        }
コード例 #4
0
        public void GetResult_NumberMultipleOfFive_pong()
        {
            PingPong testPingPong = new PingPong();

            List <string> result = testPingPong.GetResult(5);

            Assert.AreEqual("pong", result[4]);
        }
コード例 #5
0
        public void GetResult_NumberMultipleOfFifteen_pingpong()
        {
            PingPong testPingPong = new PingPong();

            List <string> result = testPingPong.GetResult(15);

            Assert.AreEqual("PingPong", result[14]);
        }
コード例 #6
0
        public void GetResult_ListofFifteen_pingpong()
        {
            PingPong      testPingPong = new PingPong();
            List <string> expected     = new List <string> {
                "1", "2", "Ping", "4", "Pong", "Ping", "7", "8", "Ping", "Pong", "11", "Ping", "13", "14", "PingPong"
            };
            List <string> result = testPingPong.GetResult(15);

            foreach (string item in result)
            {
                Console.WriteLine("Output: " + item);
            }
            CollectionAssert.AreEqual(expected, result);
        }