コード例 #1
0
        public void TestDefaultValue()
        {
            var boardModel = new BoardModel();
            var i          = boardModel.GetSquare(5);

            Assert.AreEqual(0, i);
        }
コード例 #2
0
        public void TestSetX2()
        {
            var boardModel = new BoardModel();

            boardModel.Fill("c3", 2);
            var i = boardModel.GetSquare(8);

            Assert.AreEqual(2, i);
        }
コード例 #3
0
        public void TestSetX()
        {
            var boardModel = new BoardModel();

            boardModel.Fill("b2", 1);
            var i = boardModel.GetSquare(4);

            Assert.AreEqual(1, i);
        }
コード例 #4
0
        public void TestSetInvalidSquareContent()
        {
            var boardModel = new BoardModel();

            boardModel.Fill("c3", 1);
            boardModel.Fill("c3", 0);
            var i = boardModel.GetSquare(8);

            Assert.AreEqual(1, i);
        }
コード例 #5
0
        public void TestRandom()
        {
            var boardModel = new BoardModel();

            boardModel.SetRandom(1);
            var count = Enumerable.Range(0, 9).Count(i => boardModel.GetSquare(i) == 1);

            //var count = 0;
            //for(var i = 0; i < 9; i++)
            //{
            //    if (boardModel.GetSquare(i) == 1) count++;
            //}
            Assert.AreEqual(1, count);
        }