예제 #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));
        }