Exemple #1
0
    public void LoadQuestDetails(Quest quest)
    {
        questDescription.GetComponent <TextMeshProUGUI>().text = quest.text;
        coins.text = "Coins " + quest.reward.coins.ToString();
        exp.text   = "EXP " + quest.reward.exp.ToString();
        goals.text = quest.goal.GetCurrentChoice().ToString();

        string state = questController.QuestAlreadyActive(quest) ? "Completed" : "Accept";

        acceptQuestButton.gameObject.SetActive(true);
        acceptQuestButton.GetComponentInChildren <Text>().text = state;
        acceptQuestButton.onClick.AddListener(() =>
        {
            TogglePanel(false);
        });

        if (!questController.QuestAlreadyActive(quest))
        {
            acceptQuestButton.onClick.AddListener(() =>
            {
                questController.AddQuest(quest);
            });
        }
        else if (quest.done)
        {
            acceptQuestButton.onClick.AddListener(() =>
            {
                questController.CompleteQuest(quest);
            });
        }
        else
        {
            acceptQuestButton.gameObject.SetActive(false);
        }
    }
        public async Task AddQuest_ModelIsValid_ReturnObjectResult()
        {
            _repository.Setup(x => x.AddQuest(It.IsAny <QuestInformation>()));

            var result = await _controller.AddQuest(new QuestInformation()
            {
                AnswerA       = "xyz",
                AnswerB       = "xyz",
                AnswerC       = "xyz",
                AnswerD       = "xyz",
                CorrectAnswer = 0,
                Description   = "xyz",
                ImageUrl      = "http://exmaplehttplink.pl",
                QuizId        = Guid.NewGuid(),
                Time          = 30
            });

            result.Should().BeOfType <OkResult>();
        }
Exemple #3
0
        public void ReturnAddView_When_Calls_AddQuest()
        {
            var actionResult = _sutController.AddQuest() as ViewResult;

            Assert.Equal("AddQuest", actionResult.ViewName);
        }