Ejemplo n.º 1
0
        public async Task GetPlayerQuestState_PlayerHaveProgress_ReturnCurrentProgress(
            int?lastMilestoneCompletedId,
            long questPointsEarned,
            decimal totalQuestPercentCompleted)
        {
            _playerProgressRepository
            .Setup(ppr =>
                   ppr.GetPlayerProgress(It.IsAny <string>(), It.IsAny <int>()))
            .ReturnsAsync(() =>
                          new PlayerProgress
            {
                LastMilestoneCompletedId = lastMilestoneCompletedId,
                QuestPointsEarned        = questPointsEarned
            });


            var questEngineService = new QuestEngineService(
                _playerProgressRepository.Object,
                _questPointCalculator.Object,
                _milestoneCalculator.Object,
                _gameConfiguration);

            var result = await questEngineService.GetPlayerQuestState("playerOne");

            result.Should().NotBeNull();
            result.TotalQuestPercentCompleted.Should().Be(totalQuestPercentCompleted);
            result.LastMilestoneIndexCompleted.Should().Be(lastMilestoneCompletedId);
        }
Ejemplo n.º 2
0
        public async Task GetPlayerQuestState_PlayerIdGreaterThan50_ReturnZeroProgress()
        {
            _playerProgressRepository
            .Setup(ppr =>
                   ppr.GetPlayerProgress(It.IsAny <string>(), It.IsAny <int>()))
            .ReturnsAsync(() => new PlayerProgress());


            var questEngineService = new QuestEngineService(
                _playerProgressRepository.Object,
                _questPointCalculator.Object,
                _milestoneCalculator.Object,
                _gameConfiguration);

            var result = await questEngineService.GetPlayerQuestState("player123456789012345678901234567890123456789012345678901234567890");

            result.Should().NotBeNull();
            result.TotalQuestPercentCompleted.Should().Be(0);
            result.LastMilestoneIndexCompleted.Should().BeNull();
        }