public MoveCharacterByTransitionCommandHandler(
     IMapSystemTransitionRepository transitionRepository,
     IMapSystemCharacterRepository characterRepository)
 {
     _transitionRepository = transitionRepository;
     _characterRepository  = characterRepository;
 }
        public MoveCharacterByTransitionTests()
        {
            var locationA = new Location {
                Id = 1
            };
            var locationB = new Location {
                Id = 2
            };
            var transition1 = new Transition {
                Id = 1, From = locationA, To = locationB
            };
            var transition2 = new Transition {
                Id = 2, From = locationB, To = locationA
            };
            var character = new Character {
                Id = 1, CurrentLocation = locationA
            };

            var transitionRepositoryMock = new Mock <IMapSystemTransitionRepository>();

            transitionRepositoryMock
            .Setup(a => a.GetTransition(It.IsAny <int>()))
            .ReturnsAsync((int tId) =>
            {
                switch (tId)
                {
                case 1:
                    return(transition1);

                case 2:
                    return(transition2);

                default:
                    return(null);
                }
            });
            _transitionRepository = transitionRepositoryMock.Object;

            var characterRepositoryMock = new Mock <IMapSystemCharacterRepository>();

            characterRepositoryMock
            .Setup(a => a.GetCharacter(It.IsAny <int>()))
            .ReturnsAsync((int cId) => cId == 1 ? character : null);
            characterRepositoryMock
            .Setup(a => a.UpdateCharacter(It.IsAny <Character>()))
            .Returns(Task.CompletedTask)
            .Callback((Character c) => _updatedCharacter = c);
            _characterRepository = characterRepositoryMock.Object;

            _handler = new MoveCharacterByTransitionCommandHandler(_transitionRepository, _characterRepository);
        }