Example #1
0
        public void GetInterviewQuestion_NullConnectionServer_Failure()
        {
            InterviewQuestion oQuestion;
            var res = InterviewQuestion.GetInterviewQuestion(out oQuestion, null, "objectid", 1);

            Assert.IsFalse(res.Success, "Calling GetInterviewQuestion with did not fail");
        }
Example #2
0
        public void GetInterviewQuestion_EmptyObjectId_Failure()
        {
            InterviewQuestion oQuestion;

            var res = InterviewQuestion.GetInterviewQuestion(out oQuestion, _mockServer, "", 1);

            Assert.IsFalse(res.Success, "Calling GetInterviewQuestion with did not fail");
        }
        public void InterviewQuestion_FetchTest()
        {
            List <InterviewQuestion> oQuestions;
            var res = InterviewQuestion.GetInterviewQuestions(_connectionServer, _tempHandler.ObjectId, out oQuestions);

            Assert.IsTrue(res.Success, "Failed to fetch interview questions:" + res);
            Assert.IsTrue(oQuestions.Count > 0, "No questions returned from fetch");

            InterviewQuestion oQuestion;

            res = InterviewQuestion.GetInterviewQuestion(out oQuestion, _connectionServer, _tempHandler.ObjectId, 1);
            Assert.IsTrue(res.Success, "Failed to fetch question #1:" + res);

            Console.WriteLine(oQuestion.ToString());
            oQuestion.DumpAllProps();

            res = oQuestion.Update(false, 11, "testing");
            Assert.IsTrue(res.Success, "Updating question failed:" + res);

            res = InterviewQuestion.GetInterviewQuestion(out oQuestion, _connectionServer, _tempHandler.ObjectId, 999);
            Assert.IsFalse(res.Success, "Fetching invalid question number did not fail");
        }
        public void InterviewQuestion_RecordedStreamTests()
        {
            List <InterviewQuestion> oQuestions = _tempHandler.GetInterviewQuestions(true);

            Assert.IsNotNull(oQuestions, "Null questions list created");
            Assert.IsTrue(oQuestions.Count > 0, "No questions returned from fetch");

            //fetch just a single question instead of all of them
            InterviewQuestion oQuestion;
            WebCallResult     res = InterviewQuestion.GetInterviewQuestion(out oQuestion, _connectionServer,
                                                                           _tempHandler.ObjectId, 19);

            Assert.IsTrue(res.Success, "Failed to fetch single interview question:" + res);

            string strFileName = Path.GetTempFileName().Replace(".tmp", ".wav");

            res = oQuestion.GetQuestionRecording(strFileName);
            Assert.IsFalse(res.Success, "Fetching recording that does not exist should return an error");

            res = oQuestion.SetQuestionRecording("Dummy.wav", true);
            Assert.IsTrue(res.Success, "Uplading greeting recording failed:" + res);

            res = oQuestion.RefetchInterviewHandlerData();
            Assert.IsTrue(res.Success, "Refetching data for question failed:" + res);

            res = oQuestion.GetQuestionRecording(strFileName);
            Assert.IsTrue(res.Success, "Fetching recording that was just uploaded failed:" + res);
            Assert.IsTrue(File.Exists(strFileName), "Wav file for download did not get created on hard drive:" + strFileName);

            try
            {
                File.Delete(strFileName);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to delete temporary wav download file:" + ex);
            }
        }
        public void InterviewQuestion_StaticFailureTest()
        {
            //GetInterviewHandlerQuestionRecording
            var res = InterviewQuestion.GetInterviewHandlerQuestionRecording(null, "c:\\test.wav", "objectid", 1);

            Assert.IsFalse(res.Success, "");

            res = InterviewQuestion.GetInterviewHandlerQuestionRecording(_connectionServer, "c:\\test.wav", "objectid", 1);
            Assert.IsFalse(res.Success, "");

            res = InterviewQuestion.GetInterviewHandlerQuestionRecording(_connectionServer, "", "objectid", 1);
            Assert.IsFalse(res.Success, "");

            res = InterviewQuestion.GetInterviewHandlerQuestionRecording(_connectionServer, "c:\\bogus\\bogus\\temp.wav", "objectid", 1);
            Assert.IsFalse(res.Success, "");

            res = InterviewQuestion.GetInterviewHandlerQuestionRecording(_connectionServer, "c:\\test.wav", "", 1);
            Assert.IsFalse(res.Success, "");

            res = InterviewQuestion.GetInterviewHandlerQuestionRecording(_connectionServer, "c:\\test.wav", _tempHandler.ObjectId, 999);
            Assert.IsFalse(res.Success, "");

            //GetInterviewQuestion
            InterviewQuestion oQuestion;

            res = InterviewQuestion.GetInterviewQuestion(out oQuestion, null, "objectid", 1);
            Assert.IsFalse(res.Success, "");

            res = InterviewQuestion.GetInterviewQuestion(out oQuestion, _connectionServer, "objectid", 1);
            Assert.IsFalse(res.Success, "");

            res = InterviewQuestion.GetInterviewQuestion(out oQuestion, _connectionServer, "", 1);
            Assert.IsFalse(res.Success, "");

            res = InterviewQuestion.GetInterviewQuestion(out oQuestion, _connectionServer, _tempHandler.ObjectId, 999);
            Assert.IsFalse(res.Success, "");

            //GetInterviewQuestions
            List <InterviewQuestion> oQuestions;

            res = InterviewQuestion.GetInterviewQuestions(null, "objectid", out oQuestions);
            Assert.IsFalse(res.Success, "");

            res = InterviewQuestion.GetInterviewQuestions(_connectionServer, "", out oQuestions);
            Assert.IsFalse(res.Success, "");


            //SetInterviewHandlerQuestionRecording
            res = InterviewQuestion.SetInterviewHandlerQuestionRecording(null, "c:\\temp.wav", "objectid", 1, true);
            Assert.IsFalse(res.Success, "");

            res = InterviewQuestion.SetInterviewHandlerQuestionRecording(_connectionServer, "bogus.wav", "objectid", 1, true);
            Assert.IsFalse(res.Success, "");

            res = InterviewQuestion.SetInterviewHandlerQuestionRecording(_connectionServer, "bogus.wav", "", 1, true);
            Assert.IsFalse(res.Success, "");

            res = InterviewQuestion.SetInterviewHandlerQuestionRecording(_connectionServer, "Dummy.wav", _tempHandler.ObjectId, 999, true);
            Assert.IsFalse(res.Success, "");

            //SetInterviewHandlerQuestionRecordingToStreamFile
            res = InterviewQuestion.SetInterviewHandlerQuestionRecordingToStreamFile(null, "objectid", 1, "streamid");
            Assert.IsFalse(res.Success, "");

            res = InterviewQuestion.SetInterviewHandlerQuestionRecordingToStreamFile(_connectionServer, "objectid", 1, "streamid");
            Assert.IsFalse(res.Success, "");

            res = InterviewQuestion.SetInterviewHandlerQuestionRecordingToStreamFile(_connectionServer, "", 1, "streamid");
            Assert.IsFalse(res.Success, "");

            res = InterviewQuestion.SetInterviewHandlerQuestionRecordingToStreamFile(_connectionServer, _tempHandler.ObjectId, 1, "");
            Assert.IsFalse(res.Success, "");

            res = InterviewQuestion.SetInterviewHandlerQuestionRecordingToStreamFile(_connectionServer, _tempHandler.ObjectId, 999, "streamId");
            Assert.IsFalse(res.Success, "");

            //UpdateInterviewHandlerQuestion
            res = InterviewQuestion.UpdateInterviewHandlerQuestion(null, "objectid", 1, true, 1, "test");
            Assert.IsFalse(res.Success, "");

            res = InterviewQuestion.UpdateInterviewHandlerQuestion(_connectionServer, "objectid", 1, true, 1, "test");
            Assert.IsFalse(res.Success, "");

            res = InterviewQuestion.UpdateInterviewHandlerQuestion(_connectionServer, "", 1, true, 1, "test");
            Assert.IsFalse(res.Success, "");

            res = InterviewQuestion.UpdateInterviewHandlerQuestion(_connectionServer, _tempHandler.ObjectId, 999, true, 1, "test");
            Assert.IsFalse(res.Success, "");
        }