示例#1
0
        public void Shoot_StateUnderTest_ExpectedBehavior()
        {
            // Arrange
            var   scatterShotBehaviour = new ScatterShotBehaviour();
            Board board = new Board(10);
            int   x     = 2;
            int   y     = 2;

            // Act
            var result = scatterShotBehaviour.Shoot(
                board,
                x,
                y);

            ChangePointComposite comp = new ChangePointComposite(2, 2);

            comp.Add(new ChangePointLeaf(0, 0));
            comp.Add(new ChangePointLeaf(0, 2));
            comp.Add(new ChangePointLeaf(0, 4));
            comp.Add(new ChangePointLeaf(2, 0));
            comp.Add(new ChangePointLeaf(2, 2));
            comp.Add(new ChangePointLeaf(2, 4));
            comp.Add(new ChangePointLeaf(4, 0));
            comp.Add(new ChangePointLeaf(4, 2));
            comp.Add(new ChangePointLeaf(4, 4));

            // Assert
            Assert.AreEqual(result, comp);
        }
示例#2
0
        public void WideReveal_OnReveal_Inside()
        {
            // Arrange
            var   wideReveal = new WideReveal();
            Board board      = new Board(10);
            int   x          = 2;
            int   y          = 2;

            // Act
            var result = wideReveal.OnReveal(board, x, y);

            ChangePointComposite expected = new ChangePointComposite(2, 2);

            expected.Add(new ChangePointLeaf(2, 3));
            expected.Add(new ChangePointLeaf(3, 2));
            expected.Add(new ChangePointLeaf(3, 3));

            // Assert
            Assert.AreEqual(expected, result);
        }
示例#3
0
        public void WideReveal_OnReveal_Corner()
        {
            // Arrange
            var   wideReveal = new WideReveal();
            Board board      = new Board(10);
            int   x          = 0;
            int   y          = 0;

            // Act
            var result = wideReveal.OnReveal(board, x, y);

            ChangePointComposite expected = new ChangePointComposite(0, 0);

            expected.Add(new ChangePointLeaf(0, 1));
            expected.Add(new ChangePointLeaf(1, 0));
            expected.Add(new ChangePointLeaf(1, 1));

            // Assert
            Assert.AreEqual(expected, result);
        }
        public void Shoot_StateUnderTest_ExpectedBehavior()
        {
            // Arrange
            var   lineShotBehaviour = new LineShotBehaviour(5);
            Board board             = new Board(10);
            int   x = 0;
            int   y = 0;

            //// Act
            var result = lineShotBehaviour.Shoot(
                board,
                x,
                y);

            ChangePointComposite comp = new ChangePointComposite(0, 0);

            comp.Add(new ChangePointLeaf(0, 0));
            comp.Add(new ChangePointLeaf(1, 0));
            comp.Add(new ChangePointLeaf(2, 0));

            // Assert
            Assert.AreEqual(result, comp);
        }