コード例 #1
0
        public void onClickTest()
        {
            Grid        myGrid   = new Grid(100, 100, 1, 2, new PayoffMatrix());
            StratRandom rndStrat = new StratRandom();

            // Click outside the cell
            myGrid.onClick(60, 60, rndStrat);

            // Compare the strategies names (SHOULD BE NOT EQUAL)
            Assert.AreNotEqual(rndStrat.ToString(), myGrid.Cells[0, 0].Strategy.ToString());

            // Click inside the cell
            myGrid.onClick(20, 20, rndStrat);

            // Compare the strategies names (SHOULD BE EQUAL)
            Assert.AreEqual(rndStrat.ToString(), myGrid.Cells[0, 0].Strategy.ToString());
        }
コード例 #2
0
        public void ToStringTest()
        {
            StratAlwaysCooperate actual1 = new StratAlwaysCooperate();
            string expected1             = "Always Cooperate";

            StratAlwaysDefect actual2   = new StratAlwaysDefect();
            string            expected2 = "Always Defect";

            StratBlinker actual3   = new StratBlinker();
            string       expected3 = "Blinker";

            StratRandom actual4   = new StratRandom();
            string      expected4 = "Random";

            Assert.AreEqual(expected1, actual1.ToString());
            Assert.AreEqual(expected2, actual2.ToString());
            Assert.AreEqual(expected3, actual3.ToString());
            Assert.AreEqual(expected4, actual4.ToString());
        }