コード例 #1
0
        public void DrawShipShould_WhenConstructorIsCall_ShouldReturnInstance()
        {
            //Arrange
            var spaceShipDesignMock = new Mock <ISpaceShipDesign>();

            //Act
            var result = new DrawShip(spaceShipDesignMock.Object);

            //Assert
            Assert.IsInstanceOfType(result, typeof(DrawShip));
        }
コード例 #2
0
        public void DrawShipPlayerTwo_WhenFinishDrawing_ShouldReturnMessage(string actual)
        {
            //Arrange
            var spaceShipDesignMock = new Mock <ISpaceShipDesign>();

            var playerMock = new Mock <IPlayer>();

            playerMock.SetupGet(x => x.Spaceship.Model).Returns(actual);

            var draw = new DrawShip(spaceShipDesignMock.Object);

            //Act
            var result = draw.DrawShipPlayerTwo(playerMock.Object);

            //Assert
            StringAssert.Contains(result, actual);
        }
コード例 #3
0
        public void DrawShipPlayerTwo_WhenCheckPlayerDesign_ShouldAssignRightShipDesign()
        {
            //Arrange
            var spaceShipDesignMock = new Mock <ISpaceShipDesign>();

            spaceShipDesignMock.SetupGet(x => x.DrossaRight).Returns(new string[] { "Dross-Mashup Spaceship" });
            spaceShipDesignMock.SetupGet(x => x.FuturisticRight).Returns(new string[] { "Futuristic Spaceship" });

            var playerMock = new Mock <IPlayer>();

            playerMock.SetupGet(x => x.Spaceship.Model).Returns("Dross-Mashup Spaceship");

            var draw = new DrawShip(spaceShipDesignMock.Object);

            //Act
            draw.DrawShipPlayerTwo(playerMock.Object);

            //Assert
            spaceShipDesignMock.Verify(x => x.DrossaRight, Times.Once);
        }