コード例 #1
0
        public void GivenA0DegreeHeading_WhenMoveAction_ThenMoveRightBySpeed()
        {
            var bot    = FakeGameObjectProvider.GetBotAt(new Position(0, 0));
            var action = FakeGameObjectProvider.GetForwardPlayerActionInHeading(bot.Id, 0);

            var finalPosition = vectorCalculatorService.GetPointFrom(new Position(0, 0), 10, action.Heading);

            Assert.True(finalPosition.X == 10);
            Assert.True(finalPosition.Y == 0);
        }
コード例 #2
0
        public void GivenBot_WhenActionIsProcessed_ThenVectorIsStepwiseCalculated()
        {
            SetupFakeWorld(true, false);
            var bot = FakeGameObjectProvider.GetBotWithActions();

            bot.IsMoving = true;
            vectorCalculatorServiceMock.Setup(x => x.GetPointFrom(It.IsAny <Position>(), It.IsAny <int>(), It.IsAny <int>()))
            .Returns(VectorCalculatorService.GetPointFrom(bot.Position, 1, bot.CurrentHeading));
            vectorCalculatorServiceMock.Setup(x => x.IsInWorldBounds(It.IsAny <Position>(), It.IsAny <int>())).Returns(true);
            vectorCalculatorServiceMock
            .Setup(vcs => vcs.CollectCollisionDetectionPointsAlongPath(It.IsAny <Position>(), It.IsAny <Position>(), It.IsAny <int>()))
            .Returns(
                new List <Position> {
                new Position(0, 0),
                new Position(1, 1),
                new Position(2, 2)
            });
            Assert.DoesNotThrow(() => tickProcessingService.SimulateTick());
        }