예제 #1
0
        public void InitBoardTest()
        {
            var board = new BsBoard2D(5, 5);

            Assert.AreEqual(25, board.SlotsCount());
            Assert.AreEqual(25, board.FreeSlotsCount());
            Assert.AreEqual(25, board.FreeSlots().Count());
        }
예제 #2
0
        public void AddActorTest()
        {
            var board  = new BsBoard2D(10, 10);
            var actor1 = new Mock <IBsActor>();
            var actor2 = new Mock <IBsActor>();

            Assert.IsTrue(board.Add(actor1.Object, 0));
            Assert.AreEqual(99, board.FreeSlotsCount());
            Assert.AreEqual(99, board.FreeSlots().Count());

            Assert.IsFalse(board.Add(actor2.Object, 0));
            Assert.IsFalse(board.Add(actor1.Object, 0));
            Assert.IsFalse(board.Add(actor1.Object, 1));
            Assert.AreEqual(99, board.FreeSlotsCount());
            Assert.AreEqual(99, board.FreeSlots().Count());

            board.Add(actor2.Object, 1);
            Assert.AreEqual(98, board.FreeSlotsCount());
            Assert.AreEqual(98, board.FreeSlots().Count());
        }
예제 #3
0
        public void FreeSlotsTest()
        {
            var board  = new BsBoard2D(2, 2);
            var actor1 = new Mock <IBsActor>();

            board.Add(actor1.Object, 0);

            var free = board.FreeSlots().ToArray();

            Assert.AreEqual(3, free.Length);
            Assert.AreEqual(1, free[0]);
            Assert.AreEqual(2, free[1]);
            Assert.AreEqual(3, free[2]);
            Assert.Contains(1, free);
            Assert.Contains(2, free);
            Assert.Contains(3, free);
        }