Esempio n. 1
0
        public void endOfSessionTest()
        {
            var hs = new List <IQuestion>();

            hs.Add(mockQuestion1.Object);
            hs.Add(mockQuestion2.Object);
            hs.Add(mockQuestion3.Object);

            mockStudySession.Setup(x => x.QuestionAsked).Returns(hs);
            //good
            convCtrl.Db = mockDB.Object;


            var a = convCtrl.endOfSession();
            var b = convCtrl.getPhrase(Pkey.goodSessionEnd, new string[] { }, new string[] { });

            Assert.AreEqual(convCtrl.endOfSession()[0], EnumVal(Pkey.goodSessionEnd));


            mockQuestion1.Setup(x => x.AnswerScore).Returns(30);
            mockQuestion2.Setup(x => x.AnswerScore).Returns(30);
            mockQuestion3.Setup(x => x.AnswerScore).Returns(30);

            hs = new List <IQuestion>();
            hs.Add(mockQuestion1.Object);
            hs.Add(mockQuestion2.Object);
            hs.Add(mockQuestion3.Object);
            mockStudySession.Setup(x => x.QuestionAsked).Returns(hs);

            Assert.AreEqual(convCtrl.endOfSession()[0], EnumVal(Pkey.badSessionEnd));

            //bad
            mockStudySession.Setup(x => x.QuestionAsked).Returns(new List <IQuestion>());
            Assert.AreEqual(convCtrl.endOfSession()[0], EnumVal(Pkey.earlyDiparture));



            //sad
            mockQuestion1.Setup(x => x.AnswerScore).Returns(-99999);

            hs = new List <IQuestion>();
            hs.Add(mockQuestion1.Object);
            hs.Add(mockQuestion2.Object);
            hs.Add(mockQuestion3.Object);
            mockStudySession.Setup(x => x.QuestionAsked).Returns(hs);

            Assert.AreEqual(convCtrl.endOfSession()[0], EnumVal(Pkey.badSessionEnd));
        }
Esempio n. 2
0
        public void endOfSessionIntegrationTest()
        {
            var ss = new StudySession();

            Question1.AnswerScore = 100;
            Question2.AnswerScore = 90;
            Question3.AnswerScore = 80;

            ss.QuestionAsked.Add(Question1);
            ss.QuestionAsked.Add(Question2);
            ss.QuestionAsked.Add(Question3);

            ConvCtrl = new ConversationController(new User(), ss);


            //good

            AssertNLP.contains(ConvCtrl.endOfSession(), DBbotPhrase(Pkey.goodSessionEnd));


            ss = new StudySession();
            Question1.AnswerScore = 45;
            Question2.AnswerScore = 34;
            Question3.AnswerScore = 12;

            ss.QuestionAsked.Add(Question1);
            ss.QuestionAsked.Add(Question2);
            ss.QuestionAsked.Add(Question3);

            ConvCtrl = new ConversationController(new User(), ss);

            //bad
            AssertNLP.contains(ConvCtrl.endOfSession(), DBbotPhrase(Pkey.badSessionEnd));


            ss = new StudySession();
            Question1.AnswerScore = 45;
            Question2.AnswerScore = 34;


            ss.QuestionAsked.Add(Question1);
            ss.QuestionAsked.Add(Question2);


            ConvCtrl = new ConversationController(new User(), ss);

            AssertNLP.contains(ConvCtrl.endOfSession(), DBbotPhrase(Pkey.earlyDiparture));



            ss = new StudySession();


            ss.QuestionAsked.Add(Question1);
            ss.QuestionAsked.Add(Question2);
            ss.QuestionAsked.Add(Question3);

            ConvCtrl = new ConversationController(new User(), ss);//sad


            AssertNLP.contains(ConvCtrl.endOfSession(), DBbotPhrase(Pkey.badSessionEnd));
        }