コード例 #1
0
        public void OutputPingPong_DisplayPing_RangeWithPing()
        {
            PingPong      testPingPong = new PingPong();
            List <string> expected     = new List <string>()
            {
                "0", "1", "2", "ping", "4"
            };
            List <string> actual = testPingPong.OutputPingPong(4);

            Assert.IsTrue(expected.SequenceEqual(actual));
        }
コード例 #2
0
        public void OutputPingPong_DisplayNumRange_NumberRange()
        {
            PingPong      testPingPong = new PingPong();
            List <string> expected     = new List <string>()
            {
                "0", "1", "2"
            };

            // Cannot use .AreEqual(new List<int> ... , ..OutputPingPong(4)) because compares 2 objects that are different - need to compare internal values
            // Use .SequenceEquals (!! *Import System.Linq* !!) to iterate through list and check values & order
            Assert.IsTrue(expected.SequenceEqual(testPingPong.OutputPingPong(2)));
        }