Esempio n. 1
0
 private static WorldScreen CreateWorldScreen(CharacterSpriteMock player, IMapController mapController, ScreenConstants screenConstants = null)
 {
     if(screenConstants == null)
         screenConstants = new ScreenConstants();
     var loaderMock = new Mock<ISpriteLoader>();
     loaderMock.Setup(o => o.GetSprite(It.IsAny<string>())).Returns(player);
     return new WorldScreen(mapController, loaderMock.Object, screenConstants);
 }
Esempio n. 2
0
        public void PlayerMove_GivenDirection_MapIsMovedInExpectedDirection(Direction moveDirection, Direction expectedMapMoveDirection)
        {
            var player = new CharacterSpriteMock();
            var mapMock = new Mock<IMapController>();
            var screen = CreateWorldScreen(player, mapMock.Object);

            screen.Setup();
            screen.PlayerMoveDirection(moveDirection);

            mapMock.Verify(m => m.MoveMap(expectedMapMoveDirection), Times.Once());
        }
Esempio n. 3
0
        public void Draw_NormalSetup_PlayerAndMapAreDrawn()
        {
            var player = new CharacterSpriteMock();
            var mapMock = CreateMap();
            var screen = CreateWorldScreen(player, mapMock);

            screen.Setup();
            screen.Draw();

            Assert.True(player.WasDrawn);
            Assert.True(mapMock.WasDrawn);
        }