コード例 #1
0
        public void IsPingPong_NumberDivisibleBy3_True()
        {
            PingPong testPingPong = new PingPong();

            Assert.AreEqual(true, testPingPong.IsPingPong(9));
            Console.WriteLine("Ping-Pong");
        }
コード例 #2
0
        public void IsPingPong_PrintPingPong_PingPong()
        {
            List <string> expected = new List <string> {
                "1", "2", "ping", "4", "pong", "ping", "7", "8", "ping", "pong", "11", "ping", "13", "14", "ping-pong"
            };
            PingPong actual = new PingPong();

            CollectionAssert.AreEqual(expected, actual.IsPingPong(15));
        }
コード例 #3
0
        public void IsPingPong_PrintPing_Ping()
        {
            List <string> expected = new List <string> {
                "1", "2", "ping"
            };
            PingPong actual = new PingPong();

            CollectionAssert.AreEqual(expected, actual.IsPingPong(3));
        }
コード例 #4
0
        public void IsPingPong_PrintOne_1()
        {
            List <string> expected = new List <string> {
                "1"
            };
            PingPong actual = new PingPong();

            CollectionAssert.AreEqual(expected, actual.IsPingPong(1));
        }
コード例 #5
0
        private static void StartPingPong()
        {
            Console.Write("Please enter a positive number: ");
            int  userInput;
            bool success = Int32.TryParse(Console.ReadLine(), out userInput);

            if (!success || userInput <= 0)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Invalid input");
                Console.ResetColor();
                StartPingPong();
            }
            else
            {
                List <string> result = PingPong.IsPingPong(userInput);
                Console.ForegroundColor = ConsoleColor.Magenta;
                Console.WriteLine(string.Join(", ", result));
                Console.ResetColor();
            }
        }
コード例 #6
0
        public void IsPingPong()
        {
            PingPong testPingPong = new PingPong();

            Assert.AreEqual(true, testPingPong.IsPingPong(16));
        }
コード例 #7
0
ファイル: PingPong.Test.cs プロジェクト: DanielL87/PingPong
 public void IsPingPong_NumberDivisibleByThreeAndFive_True()
 {
 // PingPong testPingPong = new PingPong();
 Assert.AreEqual("ping pong", PingPong.IsPingPong(15));
 }
コード例 #8
0
ファイル: PingPong.Test.cs プロジェクト: DanielL87/PingPong
 public void IsPingPong_NumberNotDivisibleByThreeOrFive_True()
 {
 // PingPong testPingPong = new PingPong();
 Assert.AreEqual("14", PingPong.IsPingPong(14));
 }
コード例 #9
0
        public void IsPingPong_PingPongDivisibleByThreeAndFive_True()
        {
            PingPong testPingPong = new PingPong();

            Assert.AreEqual(true, testPingPong.IsPingPong(15));
        }
コード例 #10
0
        public void IsPingPong_NumberDivisibleByThree_Ping()
        {
            PingPong testPingPong = new PingPong();

            Assert.AreEqual("ping", testPingPong.IsPingPong(3));
        }
コード例 #11
0
        public void IsPingPong_NumberDivisibleByFive_Pong()
        {
            PingPong testPingPong = new PingPong();

            Assert.AreEqual("pong", testPingPong.IsPingPong(5));
        }