コード例 #1
0
        public void playerTest()
        {
            Node[] nodes     = constructBasicBoard();
            Player mrX       = new MrX("Mr. X", 0);
            Player detective = new Detective("Detective", 1);

            mrX.setLocation(nodes[0]);
            detective.setLocation(nodes[4]);

            Assert.AreEqual(nodes[0], mrX.getLocation());
            Assert.AreEqual(nodes[4], detective.getLocation());

            Assert.AreEqual(4, mrX.getTickets(TransportType.taxi));
            Assert.AreEqual(3, mrX.getTickets(TransportType.bus));
            Assert.AreEqual(3, mrX.getTickets(TransportType.underground));
            Assert.AreEqual(2, mrX.getTickets(TransportType.blackCard));

            Assert.AreEqual(10, detective.getTickets(TransportType.taxi));
            Assert.AreEqual(8, detective.getTickets(TransportType.bus));
            Assert.AreEqual(4, detective.getTickets(TransportType.underground));

            detective.move(nodes[2], TransportType.taxi);
            Assert.AreEqual(nodes[2], detective.getLocation());
            Assert.AreEqual(9, detective.getTickets(TransportType.taxi));

            detective.move(nodes[3], TransportType.underground);
            Assert.AreEqual(nodes[3], detective.getLocation());
            Assert.AreEqual(3, detective.getTickets(TransportType.underground));

            detective.move(nodes[1], TransportType.bus);
            Assert.AreEqual(nodes[1], detective.getLocation());
            Assert.AreEqual(7, detective.getTickets(TransportType.bus));

            mrX.move(nodes[4], TransportType.blackCard);
            Assert.AreEqual(nodes[4], mrX.getLocation());
            Assert.AreEqual(1, mrX.getTickets(TransportType.blackCard));
        }
コード例 #2
0
ファイル: Tests.cs プロジェクト: GoogleJump/ZeroG
        public void playerTest()
        {
            Node[] nodes = constructBasicBoard();
            Player mrX = new MrX("Mr. X", 0);
            Player detective = new Detective("Detective", 1);

            mrX.setLocation(nodes[0]);
            detective.setLocation(nodes[4]);

            Assert.AreEqual(nodes[0], mrX.getLocation());
            Assert.AreEqual(nodes[4], detective.getLocation());

            Assert.AreEqual(4, mrX.getTickets(TransportType.taxi));
            Assert.AreEqual(3, mrX.getTickets(TransportType.bus));
            Assert.AreEqual(3, mrX.getTickets(TransportType.underground));
            Assert.AreEqual(2, mrX.getTickets(TransportType.blackCard));

            Assert.AreEqual(10, detective.getTickets(TransportType.taxi));
            Assert.AreEqual(8, detective.getTickets(TransportType.bus));
            Assert.AreEqual(4, detective.getTickets(TransportType.underground));

            detective.move(nodes[2], TransportType.taxi);
            Assert.AreEqual(nodes[2], detective.getLocation());
            Assert.AreEqual(9, detective.getTickets(TransportType.taxi));

            detective.move(nodes[3], TransportType.underground);
            Assert.AreEqual(nodes[3], detective.getLocation());
            Assert.AreEqual(3, detective.getTickets(TransportType.underground));

            detective.move(nodes[1], TransportType.bus);
            Assert.AreEqual(nodes[1], detective.getLocation());
            Assert.AreEqual(7, detective.getTickets(TransportType.bus));

            mrX.move(nodes[4], TransportType.blackCard);
            Assert.AreEqual(nodes[4], mrX.getLocation());
            Assert.AreEqual(1, mrX.getTickets(TransportType.blackCard));
        }