Exemplo n.º 1
0
        public void WhenuserAskedForBeginner_ReturnFirstQuestion_Beginner()
        {
            _request.IsNew = false;
            _intentHandler = new IntentRequestHandler(_request, DifficultyLevelEnum.Beginner, filePath);
            _questions     = _intentHandler.GetTheQuestionsForThisWeek();

            var currentQuestion = _questions.questions.First(x => x.slotIdentifier == "QuestionFive");

            var response = _intentHandler.GetQuestion();

            Assert.True(response.Response.OutputSpeech.Ssml.Contains(currentQuestion.text));
        }
Exemplo n.º 2
0
        public void WhenuserJustStartedTheSkill_ReturnFirstQuestion_Intermediate()
        {
            _request.IsNew = true;
            _intentHandler = new IntentRequestHandler(_request, DifficultyLevelEnum.Intermdiate, filePath);
            _questions     = _intentHandler.GetTheQuestionsForThisWeek();

            var currentQuestion = _questions.questions.First(x => x.slotIdentifier == "QuestionFive");

            var response = _intentHandler.GetQuestion();

            Assert.True(response.Response.OutputSpeech.Ssml.Contains(currentQuestion.text));
        }
Exemplo n.º 3
0
        public void WhenUserEnetrsAWrongInput_TellTheUserToPickANumber_Beginner()
        {
            _request.IsNew = false;
            _intentHandler = new IntentRequestHandler(_request, DifficultyLevelEnum.Beginner, filePath);
            _questions     = _intentHandler.GetTheQuestionsForThisWeek();

            var index = _request.SlotsList.FindIndex(x => x.Key == "QuestionFive");

            _request.SlotsList[index] = new KeyValuePair <string, string>("QuestionFive", "five");
            var response = _intentHandler.GetQuestion();

            Assert.True(response.Response.OutputSpeech.Ssml.Contains("pick a number"));
        }
Exemplo n.º 4
0
        public void WhenUserenetrsAWrongAnser_TellUserTheCorrectAnswer_Beginner()
        {
            _request.IsNew = false;
            _intentHandler = new IntentRequestHandler(_request, DifficultyLevelEnum.Beginner, filePath);
            _questions     = _intentHandler.GetTheQuestionsForThisWeek();
            var currentQuestion = _questions.questions.First(x => x.slotIdentifier == "QuestionFive");

            var index = _request.SlotsList.FindIndex(x => x.Key == "QuestionFive");

            _request.SlotsList[index] = new KeyValuePair <string, string>("QuestionFive", (Convert.ToInt32(currentQuestion.correctAnswerIndex) - 1).ToString());
            var response = _intentHandler.GetQuestion();

            Assert.True(response.Response.OutputSpeech.Ssml.Contains("The correct answer is"));
        }
Exemplo n.º 5
0
        public void WhenUserAsksforRepeat_RepeatTheQuestion_Beginner()
        {
            _request.IsNew = false;
            _intentHandler = new IntentRequestHandler(_request, DifficultyLevelEnum.Beginner, filePath);
            _questions     = _intentHandler.GetTheQuestionsForThisWeek();
            var currentQuestion = _questions.questions.First(x => x.slotIdentifier == "QuestionFive");

            var index = _request.SlotsList.FindIndex(x => x.Key == "QuestionFive");

            _request.SlotsList[index] = new KeyValuePair <string, string>("QuestionFive", "repeat");
            var response = _intentHandler.GetQuestion();

            Assert.True(response.Response.OutputSpeech.Ssml.Contains(currentQuestion.text));
        }
Exemplo n.º 6
0
        public void WhenUserEntersThecorrectAnswer_TellUserThatTheAnswerIsCorrect_Intermediate()
        {
            _request.IsNew = false;
            _intentHandler = new IntentRequestHandler(_request, DifficultyLevelEnum.Intermdiate, filePath);
            _questions     = _intentHandler.GetTheQuestionsForThisWeek();
            var currentQuestion = _questions.questions.First(x => x.slotIdentifier == "QuestionFive");

            var index = _request.SlotsList.FindIndex(x => x.Key == "QuestionFive");

            _request.SlotsList[index] = new KeyValuePair <string, string>("QuestionFive", currentQuestion.correctAnswerIndex);
            var response = _intentHandler.GetQuestion();

            Assert.True(response.Response.OutputSpeech.Ssml.Contains("Your answer is correct"));
        }
Exemplo n.º 7
0
        public void WhenUserIsAtTheLastQuestion_TellUserTheCorectScore_Intermediate()
        {
            _request.IsNew = false;
            _intentHandler = new IntentRequestHandler(_request, DifficultyLevelEnum.Intermdiate, filePath);
            _questions     = _intentHandler.GetTheQuestionsForThisWeek();

            _request.SlotsList = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("QuestionFive", "1"),
                new KeyValuePair <string, string>("QuestionOne", "2"),
                new KeyValuePair <string, string>("QuestionTwo", "3"),
                new KeyValuePair <string, string>("QuestionThree", "4"),
                new KeyValuePair <string, string>("QuestionFour", "1")
            };

            var response = _intentHandler.GetQuestion();

            Assert.True(response.Response.OutputSpeech.Ssml.Contains("Your total score is"));
        }
Exemplo n.º 8
0
        public QuestionsPerWeek GetTheQuestionsForThisWeek()
        {
            RootObject       listOfQuestions = DeserializeJson();
            QuestionsPerWeek result          = new QuestionsPerWeek();

            switch (_dificultyLevel)
            {
            case DifficultyLevelEnum.Beginner:
                result = QuestionsPerWeek(listOfQuestions.beginner);
                break;

            case DifficultyLevelEnum.Intermdiate:
                result = QuestionsPerWeek(listOfQuestions.intermediate);
                break;
                //case DifficultyLevel.Advanced:
                //    result = QuestionsPerWeek(listOfQuestions.advanced);
                //    break;
            }
            return(result);
        }
Exemplo n.º 9
0
        public void TellUserTheLastQuestion_Intermediate()
        {
            _request.IsNew     = false;
            _intentHandler     = new IntentRequestHandler(_request, DifficultyLevelEnum.Intermdiate, filePath);
            _questions         = _intentHandler.GetTheQuestionsForThisWeek();
            _request.SlotsList = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("QuestionFive", "1"),
                new KeyValuePair <string, string>("QuestionOne", "2"),
                new KeyValuePair <string, string>("QuestionTwo", "3"),
                new KeyValuePair <string, string>("QuestionThree", "1"),
                new KeyValuePair <string, string>("QuestionFour", "")
            };

            var questionfour = _questions.questions.First(x => x.slotIdentifier == "QuestionFour");

            var response = _intentHandler.GetQuestion();

            Assert.True(response.Response.OutputSpeech.Ssml.Contains(questionfour.text));
        }