Ejemplo n.º 1
0
        public void Robo_Initialize_Should_Throw_Exception(string command, string exceptionMessage)
        {
            var moveAreaMock = new Mock <IMoveArea <int> >();

            moveAreaMock.SetupGet(s => s.Width).Returns(10);
            moveAreaMock.SetupGet(s => s.Height).Returns(10);

            var robo = new Robo <int, int>(moveAreaMock.Object);

            Action act = () => robo.Initialize(command);

            act.Should().Throw <ArgumentException>().WithMessage(exceptionMessage);
        }
Ejemplo n.º 2
0
        public void Robo_Initialize_Should_Return_Correct_Result(string command, int x, int y, string direction)
        {
            var moveAreaMock = new Mock <IMoveArea <int> >();

            moveAreaMock.SetupGet(s => s.Width).Returns(10);
            moveAreaMock.SetupGet(s => s.Height).Returns(10);

            var robo = new Robo <int, int>(moveAreaMock.Object);

            robo.Initialize(command);

            var expetedDirection = DirectionFactory <int, int> .Create(direction);

            robo.Direction.GetType().Should().BeSameAs(expetedDirection.GetType());
            robo.Position.X.Should().Be(x);
            robo.Position.Y.Should().Be(y);
        }